Skip to content
Snippets Groups Projects
Commit d3c0495f authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

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

parent fb8c9e69
No related branches found
No related tags found
No related merge requests found
......@@ -173,7 +173,7 @@ class MenuLeft {
{
for ($j=0; $j < $tabul; $j++)
{
$tabstring.='&nbsp; &nbsp; ';
$tabstring.='&nbsp; &nbsp;';
}
}
......
......@@ -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.='&nbsp; &nbsp; ';
$tabstring.='&nbsp; &nbsp;';
}
}
......
......@@ -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);
......
<?php
/* 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>
*
* 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) )
{
......
......@@ -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 '<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 '<input type="hidden" name="action" value="add">';
......@@ -133,9 +136,16 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
// Client
print '<tr><td>'.$langs->trans("Company").'</td><td>';
$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 '</td></tr>';
// Auteur du projet
......@@ -179,13 +189,15 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
print '<table class="border" width="100%">';
// 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
print '<tr><td>'.$langs->trans("Label").'</td><td><input size="30" name="title" value="'.$projet->title.'"></td></tr>';
// 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
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);
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("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 '</table>';
}
......
<?php
/* 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-2006 Regis Houssin <regis@dolibarr.fr>
*
......@@ -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 "<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\">".$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 "</tr>\n";
......
<?php
/* 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
* 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"));
......
......@@ -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;
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment