New: Third party for projects is not always required.
This commit is contained in:
parent
5e51b2cb13
commit
94e29ce7c1
@ -71,7 +71,7 @@ class Project extends CommonObject
|
||||
$sql.= " ".$user->id.",";
|
||||
$sql.= " ".$this->user_resp_id.", ".$this->db->idate(mktime()).", 0)";
|
||||
|
||||
dolibarr_syslog("Project::create sql=".$sql);
|
||||
dolibarr_syslog("Project::create sql=".$sql,LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -96,9 +96,11 @@ class Project extends CommonObject
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."projet";
|
||||
$sql.= " SET ref='".$this->ref."'";
|
||||
$sql.= ", title = '".$this->title."'";
|
||||
$sql.= ", fk_soc = ".($this->socid > 0?$this->socid:"null");
|
||||
$sql.= ", fk_user_resp = ".$this->user_resp_id;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dolibarr_syslog("Project::update sql=".$sql,LOG_DEBUG);
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$result = 0;
|
||||
@ -142,7 +144,8 @@ class Project extends CommonObject
|
||||
$this->title = $obj->title;
|
||||
$this->titre = $obj->title;
|
||||
$this->note = $obj->note;
|
||||
$this->societe->id = $obj->fk_soc;
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->societe->id = $obj->fk_soc; // For backward compatibility
|
||||
$this->user_author_id = $obj->fk_user_creat;
|
||||
$this->user_resp_id = $obj->fk_user_resp;
|
||||
$this->statut = $obj->fk_statut;
|
||||
|
||||
@ -19,12 +19,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/projet/fiche.php
|
||||
\ingroup projet
|
||||
\brief Fiche projet
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
* \file htdocs/projet/fiche.php
|
||||
* \ingroup projet
|
||||
* \brief Fiche projet
|
||||
* \version $Id$
|
||||
*/
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
@ -49,16 +48,16 @@ $result = restrictedArea($user, 'projet', $projetid);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($_POST["action"] == 'add' && $user->rights->projet->creer)
|
||||
{
|
||||
//print $_POST["socid"];
|
||||
$pro = new Project($db);
|
||||
$pro->socid = $_POST["socid"];
|
||||
$pro->ref = $_POST["ref"];
|
||||
$pro->title = $_POST["title"];
|
||||
$pro->socid = $_POST["socid"];
|
||||
$pro->user_resp_id = $_POST["officer_project"];
|
||||
$result = $pro->create($user);
|
||||
if ($result > 0)
|
||||
@ -78,21 +77,31 @@ if ($_POST["action"] == 'update' && $user->rights->projet->creer)
|
||||
{
|
||||
if (! $_POST["cancel"])
|
||||
{
|
||||
if (!(empty($_POST["id"]) || empty($_POST["ref"]) || empty($_POST["title"])))
|
||||
$error=0;
|
||||
if (empty($_POST["ref"]))
|
||||
{
|
||||
$error++;
|
||||
$_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")).'</div>';
|
||||
}
|
||||
if (empty($_POST["title"]))
|
||||
{
|
||||
$error++;
|
||||
$_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")).'</div>';
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
$projet = new Project($db);
|
||||
$projet->id = $_POST["id"];
|
||||
$projet->ref = $_POST["ref"];
|
||||
$projet->title = $_POST["title"];
|
||||
$projet->socid = $_POST["socid"];
|
||||
$projet->user_resp_id = $_POST["officer_project"];
|
||||
$projet->update($user);
|
||||
|
||||
$_GET["id"]=$projet->id; // On retourne sur la fiche projet
|
||||
}
|
||||
else
|
||||
{
|
||||
$_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -118,8 +127,8 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user-
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader("",$langs->trans("Project"),"Projet");
|
||||
|
||||
@ -127,46 +136,51 @@ $html = new Form($db);
|
||||
|
||||
if ($_GET["action"] == 'create' && $user->rights->projet->creer)
|
||||
{
|
||||
print_titre($langs->trans("NewProject"));
|
||||
/*
|
||||
* Create
|
||||
*/
|
||||
print_titre($langs->trans("NewProject"));
|
||||
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
//if ($_REQUEST["socid"]) print '<input type="hidden" name="socid" value="'.$_REQUEST["socid"].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
// Ref
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td><input size="8" type="text" name="ref" value="'.$_POST["ref"].'"></td></tr>';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
//if ($_REQUEST["socid"]) print '<input type="hidden" name="socid" value="'.$_REQUEST["socid"].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td><input size="8" type="text" name="ref" value="'.$_POST["ref"].'"></td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input size="30" type="text" name="title" value="'.$_POST["title"].'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input size="30" type="text" name="title" value="'.$_POST["title"].'"></td></tr>';
|
||||
|
||||
// Client
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td>';
|
||||
//print $_REQUEST["socid"];
|
||||
print $html->select_societes($_REQUEST["socid"],'socid','',1);
|
||||
print '</td></tr>';
|
||||
// Client
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td>';
|
||||
//print $_REQUEST["socid"];
|
||||
print $html->select_societes($_REQUEST["socid"],'socid','',1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Auteur du projet
|
||||
print '<tr><td>'.$langs->trans("Author").'</td><td>'.$user->fullname.'</td></tr>';
|
||||
|
||||
// Responsable du projet
|
||||
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
|
||||
// Auteur du projet
|
||||
print '<tr><td>'.$langs->trans("Author").'</td><td>'.$user->fullname.'</td></tr>';
|
||||
|
||||
// Responsable du projet
|
||||
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
|
||||
$html->select_users($projet->user_resp_id,'officer_project',1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
} else {
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Fiche projet en mode visu
|
||||
*
|
||||
*/
|
||||
* Show or edit
|
||||
*/
|
||||
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
$projet = new Project($db);
|
||||
$projet->fetch($_GET["id"]);
|
||||
$projet->societe->fetch($projet->societe->id);
|
||||
@ -196,14 +210,14 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
|
||||
|
||||
// Client
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td>';
|
||||
print $projet->societe->getNomUrl(1);
|
||||
print $html->select_societes($projet->societe->id,'socid','',1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Responsable du projet
|
||||
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
|
||||
$html->select_users($projet->user_resp_id,'officer_project',1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr><td align="center" colspan="2"><input name="update" class="button" type="submit" value="'.$langs->trans("Modify").'"> <input type="submit" class="button" name="cancel" Value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
@ -211,23 +225,32 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
|
||||
else
|
||||
{
|
||||
$projet->fetch_user($projet->user_resp_id);
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td>'.$projet->ref.'</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>';
|
||||
|
||||
// Third party
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td>';
|
||||
if ($projet->societe->id) print $projet->societe->getNomUrl(1);
|
||||
if ($projet->societe->id > 0) print $projet->societe->getNomUrl(1);
|
||||
else print' ';
|
||||
print '</td></tr>';
|
||||
|
||||
// Project leader
|
||||
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>'.$projet->user->fullname.'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
* Boutons actions
|
||||
*/
|
||||
* Boutons actions
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($_GET["action"] != "edit")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user