On peut créer un projet sans le lier à un tiers.

This commit is contained in:
Laurent Destailleur 2008-03-02 22:20:44 +00:00
parent fb8c9e6990
commit d3c0495f26
9 changed files with 69 additions and 44 deletions

View File

@ -173,7 +173,7 @@ class MenuLeft {
{ {
for ($j=0; $j < $tabul; $j++) for ($j=0; $j < $tabul; $j++)
{ {
$tabstring.='&nbsp; &nbsp; '; $tabstring.='&nbsp; &nbsp;';
} }
} }

View File

@ -730,7 +730,7 @@ class MenuLeft {
{ {
$langs->load("projects"); $langs->load("projects");
$newmenu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire); $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_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); $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++) for ($j=0; $j < $tabul; $j++)
{ {
$tabstring.='&nbsp; &nbsp; '; $tabstring.='&nbsp; &nbsp;';
} }
} }

View File

@ -701,7 +701,7 @@ class MenuLeft {
$langs->load("admin"); $langs->load("admin");
$langs->load("projects"); $langs->load("projects");
$newmenu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire); $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_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); $newmenu->add(DOL_URL_ROOT."/projet/tasks/", $langs->trans("Tasks"), 0, $user->rights->projet->lire);

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/ */
/** /**
\file htdocs/project.class.php \file htdocs/project.class.php
\ingroup projet \ingroup projet
\brief Fichier de la classe de gestion des projets \brief Fichier de la classe de gestion des projets
\version $Revision$ \version $Id$
*/ */
require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
@ -61,9 +59,11 @@ class Project extends CommonObject
{ {
if (trim($this->ref)) if (trim($this->ref))
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet (ref, title, fk_soc, fk_user_creat, fk_user_resp, dateo) "; $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.= " VALUES ('".addslashes($this->ref)."', '".addslashes($this->title)."',";
$sql.= ", ".$this->socid.", ".$user->id.", ".$this->user_resp_id.", now()) ;"; $sql.= " ".($this->socid > 0?$this->socid:"null").",";
$sql.= " ".$user->id.",";
$sql.= " ".$this->user_resp_id.", now())";
if ($this->db->query($sql) ) if ($this->db->query($sql) )
{ {

View File

@ -48,12 +48,11 @@ $result = restrictedArea($user, 'projet', $projetid);
if ($_POST["action"] == 'add' && $user->rights->projet->creer) if ($_POST["action"] == 'add' && $user->rights->projet->creer)
{ {
$pro = new Project($db); $pro = new Project($db);
$pro->socid = $_GET["socid"]; $pro->socid = $_POST["socid"];
$pro->ref = $_POST["ref"]; $pro->ref = $_POST["ref"];
$pro->title = $_POST["title"]; $pro->title = $_POST["title"];
$pro->user_resp_id = $_POST["officer_project"]; $pro->user_resp_id = $_POST["officer_project"];
$result = $pro->create($user); $result = $pro->create($user);
if ($result > 0) if ($result > 0)
{ {
Header("Location:fiche.php?id=".$pro->id); 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"); llxHeader("",$langs->trans("Project"),"Projet");
$html = new Form($db); $html = new Form($db);
@ -120,8 +123,8 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
if ($mesg) print $mesg; if ($mesg) print $mesg;
print '<form action="fiche.php?socid='.$_GET["socid"].'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
if ($_REQUEST["socid"]) print '<input type="hidden" value="'.$_REQUEST["socid"].'">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
@ -133,9 +136,16 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
// Client // Client
print '<tr><td>'.$langs->trans("Company").'</td><td>'; print '<tr><td>'.$langs->trans("Company").'</td><td>';
$societe = new Societe($db); /* if ($_GET["socid"])
$societe->fetch($_GET["socid"]); {
print $societe->getNomUrl(1); $societe = new Societe($db);
$societe->fetch($_GET["socid"]);
print $societe->getNomUrl(1);
}
else
{ */
print $html->select_societes($_REQUEST["socid"],'socid','',1);
// }
print '</td></tr>'; print '</td></tr>';
// Auteur du projet // Auteur du projet
@ -179,13 +189,15 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
print '<tr><td>'.$langs->trans("Ref").'</td><td><input size="8" name="ref" value="'.$projet->ref.'"></td></tr>'; print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td><input size="8" name="ref" value="'.$projet->ref.'"></td></tr>';
// Label // Label
print '<tr><td>'.$langs->trans("Label").'</td><td><input size="30" name="title" value="'.$projet->title.'"></td></tr>'; print '<tr><td>'.$langs->trans("Label").'</td><td><input size="30" name="title" value="'.$projet->title.'"></td></tr>';
// Client // Client
print '<tr><td>'.$langs->trans("Company").'</td><td>'.$projet->societe->getNomUrl(1).'</td></tr>'; print '<tr><td>'.$langs->trans("Company").'</td><td>';
print $projet->societe->getNomUrl(1);
print '</td></tr>';
// Responsable du projet // Responsable du projet
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>'; print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
@ -201,9 +213,12 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
$projet->fetch_user($projet->user_resp_id); $projet->fetch_user($projet->user_resp_id);
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td>'.$langs->trans("Ref").'</td><td>'.$projet->ref.'</td></tr>'; print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td>'.$projet->ref.'</td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>'; print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>';
print '<tr><td>'.$langs->trans("Company").'</td><td>'.$projet->societe->getNomUrl(1).'</td></tr>'; print '<tr><td>'.$langs->trans("Company").'</td><td>';
if ($projet->societe->id) print $projet->societe->getNomUrl(1);
else print'&nbsp;';
print '</td></tr>';
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>'.$projet->user->fullname.'</td></tr>'; print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>'.$projet->user->fullname.'</td></tr>';
print '</table>'; print '</table>';
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Bariley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Bariley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr>
* *
@ -17,16 +17,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/projet/liste.php \file htdocs/projet/liste.php
\ingroup projet \ingroup projet
\brief Page liste des projets \brief Page liste des projets
\version $Revision$ \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -69,12 +66,15 @@ $pagenext = $page + 1;
llxHeader(); llxHeader();
$staticsoc=new Societe($db);
$sql = "SELECT p.rowid as projectid, p.ref, p.title, ".$db->pdate("p.dateo")." as do"; $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"; $sql .= ", s.nom, s.rowid as socid, s.client";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; 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"; 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 (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) if ($socid)
{ {
@ -133,10 +133,21 @@ if ($resql)
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print "<td><a href=\"fiche.php?id=$objp->projectid\">".img_object($langs->trans("ShowProject"),"project")." ".$objp->ref."</a></td>\n"; print "<td><a href=\"fiche.php?id=$objp->projectid\">".img_object($langs->trans("ShowProject"),"project")." ".$objp->ref."</a></td>\n";
print "<td><a href=\"fiche.php?id=$objp->projectid\">".$objp->title."</a></td>\n"; print "<td><a href=\"fiche.php?id=$objp->projectid\">".$objp->title."</a></td>\n";
print '<td>';
print img_object($langs->trans("ShowCompany"),"company");
print '&nbsp;<a href="'.DOL_URL_ROOT.'/soc.php?socid='.$objp->socid.'">'.$objp->nom.'</a></td>'; // Company
print '<td>';
if ($objp->socid)
{
$staticsoc->id=$objp->socid;
$staticsoc->nom=$objp->nom;
print $staticsoc->getNomUrl(1);
}
else
{
print '&nbsp;';
}
print '</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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 * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
*/ */
/*! /**
\file htdocs/projet/pre.inc.php \file htdocs/projet/pre.inc.php
\ingroup projet \ingroup projet
\brief Fichier de gestion du menu gauche du module projet \brief Fichier de gestion du menu gauche du module projet
\version $Revision$ \version $Id$
*/ */
require ("../main.inc.php"); require ("../main.inc.php");
@ -46,7 +42,7 @@ function llxHeader($head = "", $title="", $help_url='')
$menu = new Menu(); $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(DOL_URL_ROOT."/projet/", $langs->trans("Projects"));
$menu->add_submenu(DOL_URL_ROOT."/projet/liste.php", $langs->trans("List")); $menu->add_submenu(DOL_URL_ROOT."/projet/liste.php", $langs->trans("List"));

View File

@ -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 datea = datep where datea is null and percent = 100;
update llx_actioncomm set datea2 = datea where datea2 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;

View File

@ -21,7 +21,7 @@
create table llx_projet create table llx_projet
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_soc integer NOT NULL, fk_soc integer,
fk_statut smallint NOT NULL, fk_statut smallint NOT NULL,
tms timestamp, tms timestamp,
dateo date, -- date d'ouverture du projet dateo date, -- date d'ouverture du projet