';
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 '
";
+
+}
+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