From d3c0495f2623918aca806ffa22796fcb9ec80339 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Mar 2008 22:20:44 +0000 Subject: [PATCH] =?UTF-8?q?On=20peut=20cr=E9er=20un=20projet=20sans=20le?= =?UTF-8?q?=20lier=20=E0=20un=20tiers.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../menus/barre_left/auguria_backoffice.php | 2 +- .../menus/barre_left/eldy_backoffice.php | 4 +- .../menus/barre_left/eldy_frontoffice.php | 2 +- htdocs/project.class.php | 14 +++---- htdocs/projet/fiche.php | 37 +++++++++++++------ htdocs/projet/liste.php | 31 +++++++++++----- htdocs/projet/pre.inc.php | 18 ++++----- mysql/migration/2.2.0-2.4.0.sql | 3 ++ mysql/tables/llx_projet.sql | 2 +- 9 files changed, 69 insertions(+), 44 deletions(-) diff --git a/htdocs/includes/menus/barre_left/auguria_backoffice.php b/htdocs/includes/menus/barre_left/auguria_backoffice.php index d2986beea1f..165f898be80 100644 --- a/htdocs/includes/menus/barre_left/auguria_backoffice.php +++ b/htdocs/includes/menus/barre_left/auguria_backoffice.php @@ -173,7 +173,7 @@ class MenuLeft { { for ($j=0; $j < $tabul; $j++) { - $tabstring.='    '; + $tabstring.='   '; } } diff --git a/htdocs/includes/menus/barre_left/eldy_backoffice.php b/htdocs/includes/menus/barre_left/eldy_backoffice.php index 9bbed20e598..d98aff9a5b4 100644 --- a/htdocs/includes/menus/barre_left/eldy_backoffice.php +++ b/htdocs/includes/menus/barre_left/eldy_backoffice.php @@ -730,7 +730,7 @@ class MenuLeft { { $langs->load("projects"); $newmenu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire); - $newmenu->add_submenu(DOL_URL_ROOT."/comm/clients.php?leftmenu=projects", $langs->trans("NewProject"), 1, $user->rights->projet->creer); + $newmenu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer); $newmenu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire); $newmenu->add(DOL_URL_ROOT."/projet/tasks/", $langs->trans("Tasks"), 0, $user->rights->projet->lire); @@ -898,7 +898,7 @@ class MenuLeft { { for ($j=0; $j < $tabul; $j++) { - $tabstring.='    '; + $tabstring.='   '; } } diff --git a/htdocs/includes/menus/barre_left/eldy_frontoffice.php b/htdocs/includes/menus/barre_left/eldy_frontoffice.php index 6973f830aa6..f15c1611d4e 100644 --- a/htdocs/includes/menus/barre_left/eldy_frontoffice.php +++ b/htdocs/includes/menus/barre_left/eldy_frontoffice.php @@ -701,7 +701,7 @@ class MenuLeft { $langs->load("admin"); $langs->load("projects"); $newmenu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire); - $newmenu->add_submenu(DOL_URL_ROOT."/comm/clients.php?leftmenu=projects", $langs->trans("NewProject"), 1, $user->rights->projet->creer); + $newmenu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer); $newmenu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire); $newmenu->add(DOL_URL_ROOT."/projet/tasks/", $langs->trans("Tasks"), 0, $user->rights->projet->lire); diff --git a/htdocs/project.class.php b/htdocs/project.class.php index 0abbc29fb10..ff2f2a9dc47 100644 --- a/htdocs/project.class.php +++ b/htdocs/project.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2007 Laurent Destailleur + * Copyright (C) 2005-2008 Laurent Destailleur * Copyright (C) 2005-2007 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -16,15 +16,13 @@ * 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$ */ /** \file htdocs/project.class.php \ingroup projet \brief Fichier de la classe de gestion des projets - \version $Revision$ + \version $Id$ */ require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php"); @@ -61,9 +59,11 @@ class Project extends CommonObject { if (trim($this->ref)) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet (ref, title, fk_soc, fk_user_creat, fk_user_resp, dateo) "; - $sql.= " VALUES ('".addslashes($this->ref)."', '".addslashes($this->title)."'"; - $sql.= ", ".$this->socid.", ".$user->id.", ".$this->user_resp_id.", now()) ;"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet (ref, title, fk_soc, fk_user_creat, fk_user_resp, dateo)"; + $sql.= " VALUES ('".addslashes($this->ref)."', '".addslashes($this->title)."',"; + $sql.= " ".($this->socid > 0?$this->socid:"null").","; + $sql.= " ".$user->id.","; + $sql.= " ".$this->user_resp_id.", now())"; if ($this->db->query($sql) ) { diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index dfdb9005c53..75baffe6480 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -48,12 +48,11 @@ $result = restrictedArea($user, 'projet', $projetid); if ($_POST["action"] == 'add' && $user->rights->projet->creer) { $pro = new Project($db); - $pro->socid = $_GET["socid"]; + $pro->socid = $_POST["socid"]; $pro->ref = $_POST["ref"]; $pro->title = $_POST["title"]; $pro->user_resp_id = $_POST["officer_project"]; $result = $pro->create($user); - if ($result > 0) { Header("Location:fiche.php?id=".$pro->id); @@ -110,6 +109,10 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user- } +/* +* View +*/ + llxHeader("",$langs->trans("Project"),"Projet"); $html = new Form($db); @@ -120,8 +123,8 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) if ($mesg) print $mesg; - print '
'; - + print ''; + if ($_REQUEST["socid"]) print ''; print ''; print ''; @@ -133,9 +136,16 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) // Client print ''; // Auteur du projet @@ -179,13 +189,15 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) print '
'.$langs->trans("Company").''; - $societe = new Societe($db); - $societe->fetch($_GET["socid"]); - print $societe->getNomUrl(1); +/* if ($_GET["socid"]) + { + $societe = new Societe($db); + $societe->fetch($_GET["socid"]); + print $societe->getNomUrl(1); + } + else + { */ + print $html->select_societes($_REQUEST["socid"],'socid','',1); +// } print '
'; // Ref - print ''; + print ''; // Label print ''; // Client - print ''; + print ''; // Responsable du projet print '"; print "\n"; print "\n"; - print ''; + // Company + print ''; + print ''; print "\n"; diff --git a/htdocs/projet/pre.inc.php b/htdocs/projet/pre.inc.php index a91b946dab0..35f2fb97739 100644 --- a/htdocs/projet/pre.inc.php +++ b/htdocs/projet/pre.inc.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005 Laurent Destailleur + * Copyright (C) 2005-2008 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 @@ -15,17 +15,13 @@ * 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/projet/pre.inc.php - \ingroup projet - \brief Fichier de gestion du menu gauche du module projet - \version $Revision$ +/** + \file htdocs/projet/pre.inc.php + \ingroup projet + \brief Fichier de gestion du menu gauche du module projet + \version $Id$ */ require ("../main.inc.php"); @@ -46,7 +42,7 @@ function llxHeader($head = "", $title="", $help_url='') $menu = new Menu(); - $menu->add(DOL_URL_ROOT."/comm/clients.php", $langs->trans("Customers")); + $menu->add(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create", $langs->trans("Customers")); $menu->add(DOL_URL_ROOT."/projet/", $langs->trans("Projects")); $menu->add_submenu(DOL_URL_ROOT."/projet/liste.php", $langs->trans("List")); diff --git a/mysql/migration/2.2.0-2.4.0.sql b/mysql/migration/2.2.0-2.4.0.sql index 72549877497..5bfb4664dca 100644 --- a/mysql/migration/2.2.0-2.4.0.sql +++ b/mysql/migration/2.2.0-2.4.0.sql @@ -222,3 +222,6 @@ alter table llx_societe add column fk_prospectlevel varchar(12) after fournisseu update llx_actioncomm set datea = datep where datea is null and percent = 100; update llx_actioncomm set datea2 = datea where datea2 is null and percent = 100; + +alter table llx_projet modify fk_soc integer; + diff --git a/mysql/tables/llx_projet.sql b/mysql/tables/llx_projet.sql index e43e891ea01..d3465fd8190 100644 --- a/mysql/tables/llx_projet.sql +++ b/mysql/tables/llx_projet.sql @@ -21,7 +21,7 @@ create table llx_projet ( rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_soc integer NOT NULL, + fk_soc integer, fk_statut smallint NOT NULL, tms timestamp, dateo date, -- date d'ouverture du projet
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'.$langs->trans("Company").''.$projet->societe->getNomUrl(1).'
'.$langs->trans("Company").''; + print $projet->societe->getNomUrl(1); + print '
'.$langs->trans("OfficerProject").''; @@ -201,9 +213,12 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) $projet->fetch_user($projet->user_resp_id); print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print '
'.$langs->trans("Ref").''.$projet->ref.'
'.$langs->trans("Ref").''.$projet->ref.'
'.$langs->trans("Label").''.$projet->title.'
'.$langs->trans("Company").''.$projet->societe->getNomUrl(1).'
'.$langs->trans("Company").''; + if ($projet->societe->id) print $projet->societe->getNomUrl(1); + else print' '; + print '
'.$langs->trans("OfficerProject").''.$projet->user->fullname.'
'; } diff --git a/htdocs/projet/liste.php b/htdocs/projet/liste.php index e9ecd4398b9..b7531dfcf32 100644 --- a/htdocs/projet/liste.php +++ b/htdocs/projet/liste.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2006 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005 Marc Bariley / Ocebo * Copyright (C) 2005-2006 Regis Houssin * @@ -17,16 +17,13 @@ * 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/projet/liste.php \ingroup projet \brief Page liste des projets - \version $Revision$ + \version $Id$ */ require("./pre.inc.php"); @@ -69,12 +66,15 @@ $pagenext = $page + 1; llxHeader(); +$staticsoc=new Societe($db); + $sql = "SELECT p.rowid as projectid, p.ref, p.title, ".$db->pdate("p.dateo")." as do"; $sql .= ", s.nom, s.rowid as socid, s.client"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."projet as p"; +$sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql .= " WHERE p.fk_soc = s.rowid"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = p.fk_soc"; +$sql .= " WHERE 1 = 1 "; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) { @@ -133,10 +133,21 @@ if ($resql) print "
projectid\">".img_object($langs->trans("ShowProject"),"project")." ".$objp->ref."projectid\">".$objp->title."'; - print img_object($langs->trans("ShowCompany"),"company"); - print ' '.$objp->nom.''; + if ($objp->socid) + { + $staticsoc->id=$objp->socid; + $staticsoc->nom=$objp->nom; + print $staticsoc->getNomUrl(1); + } + else + { + print ' '; + } + print '