From 9a9f76fab926beeadeb5c47b49205190a0abf8e4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Jul 2005 21:58:20 +0000 Subject: [PATCH] =?UTF-8?q?New:=20Ajout=20liste=20des=20contrats=20inactif?= =?UTF-8?q?s=20et=20ferm=E9s=20dans=20menu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/comm/fiche.php | 3 +- htdocs/contrat/fiche.php | 14 ++- htdocs/contrat/ligne.php | 2 + htdocs/contrat/pre.inc.php | 32 ++--- htdocs/contrat/services.php | 139 ++++++++++++++++++++++ htdocs/includes/menus/barre_left/eldy.php | 8 +- htdocs/langs/en_US/contracts.lang | 6 + htdocs/langs/fr_FR/contracts.lang | 8 +- 8 files changed, 189 insertions(+), 23 deletions(-) create mode 100644 htdocs/contrat/services.php diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 29615d07160..59455baaf94 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -576,7 +576,7 @@ if ($_socid > 0) $result = $db->query($sql); $i = 0; $num = $db->num_rows($result); - $tag = true; + $var=true; while ($i < $num) { @@ -622,7 +622,6 @@ if ($_socid > 0) print "\n"; $i++; - $tag = !$tag; } print ""; diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 16e1b534972..1c1fbede039 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -625,25 +625,31 @@ else { print ' '; } - // Icon update et delete - if ($contrat->statut == 0 && $objp->statut == 0 && $user->rights->contrat->creer) + // Icon update et delete (statut contrat 0=brouillon,1=validé,2=fermé) + if ($contrat->statut != 2 && $user->rights->contrat->creer) { print ''; print img_edit(); print ''; + } + else { + print ' '; + } + if ($contrat->statut == 0 && $user->rights->contrat->creer) + { print ''; print img_delete(); print ''; } else { - print ' '; + print ' '; } // Statut print ''; if ($contrat->statut == 1) print '';; - print 'statut'; + print img_statut($objp->statut); if ($contrat->statut == 1) print ''; print ''; diff --git a/htdocs/contrat/ligne.php b/htdocs/contrat/ligne.php index cd513824d0a..d8ec4ecdbf9 100644 --- a/htdocs/contrat/ligne.php +++ b/htdocs/contrat/ligne.php @@ -422,6 +422,8 @@ if ($id > 0) print ''; print ''; + + print ''.$langs->trans("Comment").''; print ''; print ''; diff --git a/htdocs/contrat/pre.inc.php b/htdocs/contrat/pre.inc.php index 373112f3da6..de1c5947ff5 100644 --- a/htdocs/contrat/pre.inc.php +++ b/htdocs/contrat/pre.inc.php @@ -1,5 +1,6 @@ + * Copyright (C) 2005 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 @@ -19,29 +20,32 @@ * $Source$ * */ + +/** + \file htdocs/contrat/pre.inc.php + \ingroup contrat + \brief Fichier de gestion du menu gauche de l'espace contrat + \version $Revision$ +*/ + require("../main.inc.php"); function llxHeader($head = "", $urlp = "") { - global $user, $conf; - - /* - * - * - */ + global $user, $conf, $langs; + $langs->load("contracts"); + top_menu($head); $menu = new Menu(); - $menu->add(DOL_URL_ROOT."/contrat/index.php", "Contrats"); - $menu->add_submenu(DOL_URL_ROOT."/contrat/liste.php", "Liste"); - $menu->add_submenu(DOL_URL_ROOT."/contrat/enservice.php", "En service"); + $menu->add(DOL_URL_ROOT."/contrat/index.php", $langs->trans("Contracts")); + $menu->add_submenu(DOL_URL_ROOT."/contrat/liste.php", $langs->trans("List")); + $menu->add_submenu(DOL_URL_ROOT."/contrat/services.php", $langs->trans("MenuServices")); + $menu->add_submenu(DOL_URL_ROOT."/contrat/services.php?mode=0", $langs->trans("MenuInactiveServices"), 2 , true); + $menu->add_submenu(DOL_URL_ROOT."/contrat/services.php?mode=4", $langs->trans("MenuRunningServices"), 2 , true); + $menu->add_submenu(DOL_URL_ROOT."/contrat/services.php?mode=5", $langs->trans("MenuClosedServices"), 2 , true); left_menu($menu->liste); - /* - * - * - */ - } ?> diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php new file mode 100644 index 00000000000..8133c0b85bf --- /dev/null +++ b/htdocs/contrat/services.php @@ -0,0 +1,139 @@ + + * Copyright (C) 2004-2005 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +/** + \file htdocs/contrat/services.php + \ingroup contrat + \brief Page liste des contrats en service + \version $Revision$ +*/ + +require("./pre.inc.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"]; +$page = isset($_GET["page"])?$_GET["page"]:$_POST["page"]; + +$statut=isset($_GET["statut"])?$_GET["statut"]:1; +$socid=$_GET["socid"]; + + +llxHeader(); + +// Sécurité accés client +if ($user->societe_id > 0) +{ + $action = ''; + $socid = $user->societe_id; +} + + +if ($page == -1) { $page = 0 ; } +$limit = $conf->liste_limit; +$offset = $limit * $page ; + +if (! $sortfield) $sortfield="cd.date_ouverture"; +if (! $sortorder) $sortorder="DESC"; + + +$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_prevue")." as date_ouverture_prevue,"; +$sql.= " ".$db->pdate("cd.date_ouverture")." as date_ouverture,"; +$sql.= " ".$db->pdate("cd.date_fin_validite")." as date_fin_validite"; +$sql.= " FROM ".MAIN_DB_PREFIX."contrat as c"; +$sql.= " , ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product as p"; +$sql.= " , ".MAIN_DB_PREFIX."contratdet as cd"; +$sql.= " WHERE c.fk_soc = s.idp AND cd.fk_product = p.rowid"; +if ($mode == "0") $sql.= " AND cd.statut = 0"; +if ($mode == "4") $sql.= " AND cd.statut = 4"; +if ($mode == "5") $sql.= " AND cd.statut = 5"; +// \todo filtre sur services expirés +//if ($mode == "expired") $sql.= " AND cd.statut = 1"; +$sql.= " AND cd.fk_contrat = c.rowid"; +if ($socid > 0) +{ + $sql .= " AND s.idp = $socid"; +} +$sql .= " ORDER BY $sortfield $sortorder"; +$sql .= $db->plimit($limit + 1 ,$offset); + +$resql=$db->query($sql); +if ($resql) +{ + $num = $db->num_rows($resql); + $i = 0; + + print_barre_liste($langs->trans("ListOfServices"), $page, "services.php", "&sref=$sref&snom=$snom", $sortfield, $sortorder,'',$num); + + print ''; + + print ''; + print_liste_field_titre($langs->trans("Contract"),"services.php", "c.rowid","&mode=$mode","","",$sortfield); + print_liste_field_titre($langs->trans("Service"),"services.php", "p.label","&mode=$mode","","",$sortfield); + print_liste_field_titre($langs->trans("Company"),"services.php", "s.nom","&mode=$mode","","",$sortfield); + if ($mode == "0") print_liste_field_titre($langs->trans("DateStartPlannedShort"),"services.php", "cd.date_ouverture_prevue","&mode=$mode",'',' align="center"',$sortfield); + if ($mode =="" || $mode > 0) print_liste_field_titre($langs->trans("DateStartRealShort"),"services.php", "cd.date_ouverture","&mode=$mode",'',' align="center"',$sortfield); + print_liste_field_titre($langs->trans("DateEndPlannedShort"),"services.php", "cd.date_fin_validite","&mode=$mode",'',' align="center"',$sortfield); + print_liste_field_titre($langs->trans("Status"),"services.php", "cd.statut","&mode=$mode","","",$sortfield); + print "\n"; + + $now=mktime(); + $var=True; + while ($i < min($num,$limit)) + { + $obj = $db->fetch_object($resql); + $var=!$var; + print ""; + print ''; + print ''; + print ''; + if ($mode == "0") print ''; + if ($mode == "" || $mode > 0) print ''; + print ''; + print ''; + print "\n"; + $i++; + } + $db->free($resql); + + print "
'.img_object($langs->trans("ShowContract"),"contract").' '.$obj->cid.''.img_object($langs->trans("ShowService"),"service").' '.dolibarr_trunc($obj->label,20).''.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->nom,44).''.($obj->date_ouverture_prevue?dolibarr_print_date($obj->date_ouverture_prevue):' ').''.($obj->date_ouverture?dolibarr_print_date($obj->date_ouverture):' ').''.($obj->date_fin_validite?dolibarr_print_date($obj->date_fin_validite):' '); + if ($obj->date_fin_validite && $obj->date_fin_validite < mktime()) print img_warning($langs->trans("Late")); + else print '    '; + print 'statut
"; + +} +else +{ + dolibarr_print_error($db); +} + + +$db->close(); + +llxFooter('$Date$ - $Revision$'); +?> diff --git a/htdocs/includes/menus/barre_left/eldy.php b/htdocs/includes/menus/barre_left/eldy.php index 5f5824aa3b9..a13eb60ed13 100644 --- a/htdocs/includes/menus/barre_left/eldy.php +++ b/htdocs/includes/menus/barre_left/eldy.php @@ -209,8 +209,12 @@ class MenuLeft { $langs->load("contracts"); $newmenu->add(DOL_URL_ROOT."/contrat/index.php?leftmenu=contracts", $langs->trans("Contracts"), 0 ,$user->rights->contrat->lire); if ($leftmenu=="contracts") $newmenu->add_submenu(DOL_URL_ROOT."/societe.php?leftmenu=contracts", $langs->trans("NewContract"), 1, $user->rights->contrat->creer); - if ($leftmenu=="contracts") $newmenu->add_submenu(DOL_URL_ROOT."/contrat/liste.php", $langs->trans("List"), 1 ,$user->rights->contrat->lire); - if ($leftmenu=="contracts") $newmenu->add_submenu(DOL_URL_ROOT."/contrat/enservice.php", $langs->trans("MenuRunningServices"), 1 ,$user->rights->contrat->lire); + if ($leftmenu=="contracts") $newmenu->add_submenu(DOL_URL_ROOT."/contrat/liste.php?leftmenu=contracts", $langs->trans("List"), 1 ,$user->rights->contrat->lire); + if ($leftmenu=="contracts") $newmenu->add_submenu(DOL_URL_ROOT."/contrat/services.php?leftmenu=contracts", $langs->trans("MenuServices"), 1 ,$user->rights->contrat->lire); + if ($leftmenu=="contracts") $newmenu->add_submenu(DOL_URL_ROOT."/contrat/services.php?leftmenu=contracts&mode=0", $langs->trans("MenuInactiveServices"), 2 ,$user->rights->contrat->lire); + if ($leftmenu=="contracts") $newmenu->add_submenu(DOL_URL_ROOT."/contrat/services.php?leftmenu=contracts&mode=4", $langs->trans("MenuRunningServices"), 2 ,$user->rights->contrat->lire); + //if ($leftmenu=="contracts") $newmenu->add_submenu(DOL_URL_ROOT."/contrat/services.php?leftmenu=contracts&mode=4", $langs->trans("MenuExpiredServices"), 2 ,$user->rights->contrat->lire); + if ($leftmenu=="contracts") $newmenu->add_submenu(DOL_URL_ROOT."/contrat/services.php?leftmenu=contracts&mode=5", $langs->trans("MenuClosedServices"), 2 ,$user->rights->contrat->lire); } // Interventions diff --git a/htdocs/langs/en_US/contracts.lang b/htdocs/langs/en_US/contracts.lang index 1dd04028907..bf5c1659ec9 100644 --- a/htdocs/langs/en_US/contracts.lang +++ b/htdocs/langs/en_US/contracts.lang @@ -17,7 +17,11 @@ ServiceStatusClosed=Closed ServicesLegend=Services legend Contracts=Contracts Contract=Contract +MenuServices=Services +MenuInactiveServices=Services not active MenuRunningServices=Running services +MenuExpiredServices=Expired services +MenuClosedServices=Closed services NewContract=New contract AddContract=Add contract SearchAContract=Search a contract @@ -33,6 +37,7 @@ DateServiceUnactivate=Date of service unactivation DateServiceStart=Date for beginning of service DateServiceEnd=Date for end of service ShowContract=Show contract +ListOfServices=List of services ListOfRunningContractsLines=List of running contract lines ListOfRunningServices=List of running services NotActivatedServices=Not activated services (among validated contracts) @@ -43,6 +48,7 @@ EditServiceLine=Edit service line ContractStartDate=Start date ContractEndDate=End date DateStartPlanned=Planed start date +DateStartPlannedShort=Planed start date DateEndPlanned=Planed end date DateEndPlannedShort=Planed end date DateStartReal=Real start date diff --git a/htdocs/langs/fr_FR/contracts.lang b/htdocs/langs/fr_FR/contracts.lang index 927c40a8d08..c14a037052e 100644 --- a/htdocs/langs/fr_FR/contracts.lang +++ b/htdocs/langs/fr_FR/contracts.lang @@ -17,7 +17,11 @@ ServiceStatusClosed=Ferm ServicesLegend=Légende pour les services Contracts=Contrats Contract=Contrat +MenuServices=Services +MenuInactiveServices=Services inactifs MenuRunningServices=Services actifs +MenuExpiredServices=Services expirés +MenuClosedServices=Services fermés NewContract=Nouveau contrat AddContract=Créer contrat SearchAContract=Rechercher un contrat @@ -33,16 +37,18 @@ DateServiceUnactivate=Date d DateServiceStart=Date début du service DateServiceEnd=Date fin du service ShowContract=Afficher contrat +ListOfServices=Liste des services ListOfRunningContractsLines=Liste des lignes de contrats en service ListOfRunningServices=Liste des services actifs NotActivatedServices=Services non activés (parmi les contrats validés) LastContracts=Les % derniers contrats LastActivatedServices=Les %s derniers services activés -LastModififedServices=Les %s derniers services modifiés +LastModifiedServices=Les %s derniers services modifiés EditServiceLine=Edition ligne du service ContractStartDate=Date début ContractEndDate=Date fin DateStartPlanned=Date prévue mise en service +DateStartPlannedShort=Date début prévue DateEndPlanned=Date prévue fin de service DateEndPlannedShort=Date fin prévue DateStartReal=Date effective mise en service