diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php
index 2c4e0800582..e34769b1602 100644
--- a/htdocs/projet/contact.php
+++ b/htdocs/projet/contact.php
@@ -223,29 +223,10 @@ if ($id > 0 || ! empty($ref))
else print ' ';
print '';
- // Project leader
- print '
| '.$langs->trans("OfficerProject").' | ';
- $contact = $project->liste_contact(4,'internal');
- $num=sizeof($contact);
- if ($num)
- {
- $i = 0;
- while ($i < $num)
- {
- if ($contact[$i]['code'] == 'PROJECTLEADER')
- {
- $userstatic->id = $contact[$i]['id'];
- $userstatic->fetch();
- print $userstatic->getNomUrl(1);
- print ' ';
- }
- $i++;
- }
- }
- else
- {
- print $langs->trans('SharedProject');
- }
+ // Visibility
+ print ' |
| '.$langs->trans("Visibility").' | ';
+ if ($project->public) print $langs->trans('SharedProject');
+ else print $langs->trans('Private');
print ' |
';
// Statut
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index f171077d6f3..a387c694e63 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -86,29 +86,10 @@ if (! empty($project->societe->id)) print $project->societe->getNomUrl(1);
else print ' ';
print '';
-// Project leader
-print '| '.$langs->trans("OfficerProject").' | ';
-$contact = $project->liste_contact(4,'internal');
-$num=sizeof($contact);
-if ($num)
-{
- $i = 0;
- while ($i < $num)
- {
- if ($contact[$i]['code'] == 'PROJECTLEADER')
- {
- $userstatic->id = $contact[$i]['id'];
- $userstatic->fetch();
- print $userstatic->getNomUrl(1);
- print ' ';
- }
- $i++;
- }
-}
-else
-{
- print $langs->trans('SharedProject');
-}
+// Visibility
+print ' |
| '.$langs->trans("Visibility").' | ';
+if ($project->public) print $langs->trans('SharedProject');
+else print $langs->trans('Private');
print ' |
';
// Statut
diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php
index 635c22d424f..0bb66236c08 100644
--- a/htdocs/projet/fiche.php
+++ b/htdocs/projet/fiche.php
@@ -78,7 +78,7 @@ if ($_POST["action"] == 'add' && $user->rights->projet->creer)
$project->title = $_POST["title"];
$project->socid = $_POST["socid"];
$project->description = $_POST["description"];
- $project->user_resp_id = $_POST["officer_project"];
+ //$project->user_resp_id = $_POST["officer_project"];
$project->datec=dol_now('tzserver');
$project->dateo=dol_mktime(12,0,0,$_POST['projectmonth'],$_POST['projectday'],$_POST['projectyear']);
$project->datee=dol_mktime(12,0,0,$_POST['projectendmonth'],$_POST['projectendday'],$_POST['projectendyear']);
@@ -274,17 +274,10 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
print $html->select_societes($_REQUEST["socid"],'socid','',1,1);
print '';
- // Project leader
- print '| '.$langs->trans("OfficerProject").' | ';
- if ($_REQUEST["mode"] != 'mine')
- {
- $html->select_users($project->user_resp_id,'officer_project',1);
- }
- else
- {
- print $user->getNomUrl(1);
- print '';
- }
+ // Public
+ print ' |
| '.$langs->trans("Visibility").' | ';
+ $array=array(0 => $langs->trans("Private"),1 => $langs->trans("SharedProject"));
+ $html->select_array('public',$array,$project->public);
print ' |
';
// Date start
@@ -394,29 +387,10 @@ else
print $html->select_societes($project->societe->id,'socid','',1,1);
print '';
- // Project leader
- print '| '.$langs->trans("OfficerProject").' | ';
- $contact = $project->liste_contact(4,'internal');
- $num=sizeof($contact);
- if ($num)
- {
- $i = 0;
- while ($i < $num)
- {
- if ($contact[$i]['code'] == 'PROJECTLEADER')
- {
- $userstatic->id = $contact[$i]['id'];
- $userstatic->fetch();
- print $userstatic->getNomUrl(1);
- print ' ';
- }
- $i++;
- }
- }
- else
- {
- print $langs->trans('SharedProject');
- }
+ // Visibility
+ print ' |
| '.$langs->trans("Visibility").' | ';
+ if ($project->public) print $langs->trans('SharedProject');
+ else print $langs->trans('Private');
print ' |
';
// Statut
@@ -463,29 +437,10 @@ else
else print' ';
print '';
- // Project leader
- print '| '.$langs->trans("OfficerProject").' | ';
- $contact = $project->liste_contact(4,'internal');
- $num=sizeof($contact);
- if ($num)
- {
- $i = 0;
- while ($i < $num)
- {
- if ($contact[$i]['code'] == 'PROJECTLEADER')
- {
- $userstatic->id = $contact[$i]['id'];
- $userstatic->fetch();
- print $userstatic->getNomUrl(1);
- print ' ';
- }
- $i++;
- }
- }
- else
- {
- print $langs->trans('SharedProject');
- }
+ // Visibility
+ print ' |
| '.$langs->trans("Visibility").' | ';
+ if ($project->public) print $langs->trans('SharedProject');
+ else print $langs->trans('Private');
print ' |
';
// Statut
diff --git a/htdocs/projet/liste.php b/htdocs/projet/liste.php
index dccf8b5ecde..1c80c389d7e 100644
--- a/htdocs/projet/liste.php
+++ b/htdocs/projet/liste.php
@@ -110,7 +110,7 @@ if ($resql)
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"p.ref","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"p.title","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","","",$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("OfficerProject"),$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Visibility"),$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],'p.fk_statut',"","",'align="right"',$sortfield,$sortorder);
print "\n";
diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php
index 7294ea98bdd..cefc733f78d 100644
--- a/htdocs/projet/note.php
+++ b/htdocs/projet/note.php
@@ -149,29 +149,10 @@ if ($id > 0 || ! empty($ref))
else print' ';
print '';
- // Project leader
- print '| '.$langs->trans("OfficerProject").' | ';
- $contact = $project->liste_contact(4,'internal');
- $num=sizeof($contact);
- if ($num)
- {
- $i = 0;
- while ($i < $num)
- {
- if ($contact[$i]['code'] == 'PROJECTLEADER')
- {
- $userstatic->id = $contact[$i]['id'];
- $userstatic->fetch();
- print $userstatic->getNomUrl(1);
- print ' ';
- }
- $i++;
- }
- }
- else
- {
- print $langs->trans('SharedProject');
- }
+ // Visibility
+ print ' |
| '.$langs->trans("Visibility").' | ';
+ if ($project->public) print $langs->trans('SharedProject');
+ else print $langs->trans('Private');
print ' |
';
// Statut
diff --git a/htdocs/projet/project.class.php b/htdocs/projet/project.class.php
index d2d97345bba..90788e72702 100644
--- a/htdocs/projet/project.class.php
+++ b/htdocs/projet/project.class.php
@@ -49,7 +49,8 @@ class Project extends CommonObject
var $date_end;
var $socid;
var $user_author_id; //!< Id of project creator. Not defined if shared project.
- var $user_resp_id; //!< Id of project responsible. Not defined if shared project.
+ //var $user_resp_id; //!< Id of project responsible. Not defined if shared project.
+ var $public; //!< Tell if this is a public or private project
var $note_private;
var $note_public;
@@ -90,6 +91,7 @@ class Project extends CommonObject
$sql.= ", description";
$sql.= ", fk_soc";
$sql.= ", fk_user_creat";
+ $sql.= ", public";
$sql.= ", datec";
$sql.= ", dateo";
$sql.= ", datee";
@@ -99,6 +101,7 @@ class Project extends CommonObject
$sql.= ", '".addslashes($this->description)."'";
$sql.= ", ".($this->socid > 0?$this->socid:"null");
$sql.= ", ".$user->id;
+ $sql.= ", ".($this->public?1:0);
$sql.= ", ".($this->datec!=''?$this->db->idate($this->datec):'null');
$sql.= ", ".($this->dateo!=''?$this->db->idate($this->dateo):'null');
$sql.= ", ".($this->datee!=''?$this->db->idate($this->datee):'null');
@@ -142,6 +145,7 @@ class Project extends CommonObject
$sql.= ", description = '".addslashes($this->description)."'";
$sql.= ", fk_soc = ".($this->socid > 0?$this->socid:"null");
$sql.= ", fk_statut = ".$this->statut;
+ $sql.= ", public = ".($this->public?1:0);
$sql.= ", datec=".($this->date_c!=''?$this->db->idate($this->date_c):'null');
$sql.= ", dateo=".($this->date_start!=''?$this->db->idate($this->date_start):'null');
$sql.= ", datee=".($this->date_end!=''?$this->db->idate($this->date_end):'null');
@@ -179,7 +183,7 @@ class Project extends CommonObject
{
if (empty($id) && empty($ref)) return -1;
- $sql = "SELECT rowid, ref, title, description, datec";
+ $sql = "SELECT rowid, ref, title, description, public, datec";
$sql.= ", tms, dateo, datee, fk_soc, fk_user_creat, fk_statut, note_private, note_public";
$sql.= " FROM ".MAIN_DB_PREFIX."projet";
if ($ref) $sql.= " WHERE ref='".$ref."'";
@@ -209,6 +213,7 @@ class Project extends CommonObject
$this->socid = $obj->fk_soc;
$this->societe->id = $obj->fk_soc; // TODO For backward compatibility
$this->user_author_id = $obj->fk_user_creat;
+ $this->public = $obj->public;
$this->statut = $obj->fk_statut;
$this->db->free($resql);
diff --git a/htdocs/projet/tasks/fiche.php b/htdocs/projet/tasks/fiche.php
index 2cc5fa1aaf5..19546dcee8a 100644
--- a/htdocs/projet/tasks/fiche.php
+++ b/htdocs/projet/tasks/fiche.php
@@ -75,13 +75,13 @@ if ($_POST["action"] == 'createtask' && $user->rights->projet->creer)
$task->progress = $_POST['progress'];
$taskid = $task->create($user);
-
+
if ($taskid > 0)
- {
+ {
$result = $task->add_contact($_POST["userid"], 'TASKEXECUTIVE', 'internal');
}
}
-
+
if (! $error)
{
if (empty($projectid))
@@ -117,7 +117,7 @@ if ($id > 0 || ! empty($ref))
$project = new Project($db);
$project->fetch($_REQUEST["id"],$_GET["ref"]);
if ($project->societe->id > 0) $result=$project->societe->fetch($project->societe->id);
-
+
// To verify role of users
$userAccess = 0;
if (!empty($project->user_author_id) && $project->user_author_id == $user->id) $userAccess=1;
@@ -166,7 +166,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->task->creer && $userAc
print '| '.$langs->trans("AffectedTo").' | ';
print $form->select_users($user->id,'userid',1);
print ' |
';
-
+
// Date start
print '| '.$langs->trans("DateStart").' | ';
print $form->select_date('','dateo');
@@ -176,18 +176,18 @@ if ($_GET["action"] == 'create' && $user->rights->projet->task->creer && $userAc
print ' |
| '.$langs->trans("DateEnd").' | ';
print $form->select_date(-1,'datee');
print ' |
';
-
+
// Progress
print '| '.$langs->trans("Progress").' | ';
print $formother->select_percent($task->progress,'progress');
print ' |
';
-
+
// Description
print '| '.$langs->trans("Description").' | ';
print '';
print '';
print ' |
';
-
+
$tasksarray=$task->getTasksArray(0, $user, 1);
print '| ';
@@ -210,7 +210,7 @@ else
*
*/
$userstatic=new User($db);
-
+
$tab='tasks';
if ($_REQUEST["mode"]=='mine') $tab='mytasks';
@@ -236,36 +236,17 @@ else
print ' | ';
print '
';
- // Project leader
- print '| '.$langs->trans("OfficerProject").' | ';
- $contact = $project->liste_contact(4,'internal');
- $num=sizeof($contact);
- if ($num)
- {
- $i = 0;
- while ($i < $num)
- {
- if ($contact[$i]['code'] == 'PROJECTLEADER')
- {
- $userstatic->id = $contact[$i]['id'];
- $userstatic->fetch();
- print $userstatic->getNomUrl(1);
- print ' ';
- }
- $i++;
- }
- }
- else
- {
- print $langs->trans('SharedProject');
- }
+ // Visibility
+ print ' |
| '.$langs->trans("Visibility").' | ';
+ if ($project->public) print $langs->trans('SharedProject');
+ else print $langs->trans('Private');
print ' |
';
// Statut
print '| '.$langs->trans("Status").' | '.$project->getLibStatut(4).' |
';
print '';
-
+
print '';
/*