Some fix on project
This commit is contained in:
parent
b931da0f9a
commit
93cf727a1c
@ -223,29 +223,10 @@ if ($id > 0 || ! empty($ref))
|
||||
else print ' ';
|
||||
print '</td></tr>';
|
||||
|
||||
// Project leader
|
||||
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
|
||||
$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 '<br>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans('SharedProject');
|
||||
}
|
||||
// Visibility
|
||||
print '<tr><td>'.$langs->trans("Visibility").'</td><td>';
|
||||
if ($project->public) print $langs->trans('SharedProject');
|
||||
else print $langs->trans('Private');
|
||||
print '</td></tr>';
|
||||
|
||||
// Statut
|
||||
|
||||
@ -86,29 +86,10 @@ if (! empty($project->societe->id)) print $project->societe->getNomUrl(1);
|
||||
else print ' ';
|
||||
print '</td></tr>';
|
||||
|
||||
// Project leader
|
||||
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
|
||||
$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 '<br>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans('SharedProject');
|
||||
}
|
||||
// Visibility
|
||||
print '<tr><td>'.$langs->trans("Visibility").'</td><td>';
|
||||
if ($project->public) print $langs->trans('SharedProject');
|
||||
else print $langs->trans('Private');
|
||||
print '</td></tr>';
|
||||
|
||||
// Statut
|
||||
|
||||
@ -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 '</td></tr>';
|
||||
|
||||
// Project leader
|
||||
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
|
||||
if ($_REQUEST["mode"] != 'mine')
|
||||
{
|
||||
$html->select_users($project->user_resp_id,'officer_project',1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $user->getNomUrl(1);
|
||||
print '<input type="hidden" name="officer_project" value="'.$user->id.'">';
|
||||
}
|
||||
// Public
|
||||
print '<tr><td>'.$langs->trans("Visibility").'</td><td>';
|
||||
$array=array(0 => $langs->trans("Private"),1 => $langs->trans("SharedProject"));
|
||||
$html->select_array('public',$array,$project->public);
|
||||
print '</td></tr>';
|
||||
|
||||
// Date start
|
||||
@ -394,29 +387,10 @@ else
|
||||
print $html->select_societes($project->societe->id,'socid','',1,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Project leader
|
||||
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
|
||||
$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 '<br>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans('SharedProject');
|
||||
}
|
||||
// Visibility
|
||||
print '<tr><td>'.$langs->trans("Visibility").'</td><td>';
|
||||
if ($project->public) print $langs->trans('SharedProject');
|
||||
else print $langs->trans('Private');
|
||||
print '</td></tr>';
|
||||
|
||||
// Statut
|
||||
@ -463,29 +437,10 @@ else
|
||||
else print' ';
|
||||
print '</td></tr>';
|
||||
|
||||
// Project leader
|
||||
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
|
||||
$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 '<br>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans('SharedProject');
|
||||
}
|
||||
// Visibility
|
||||
print '<tr><td>'.$langs->trans("Visibility").'</td><td>';
|
||||
if ($project->public) print $langs->trans('SharedProject');
|
||||
else print $langs->trans('Private');
|
||||
print '</td></tr>';
|
||||
|
||||
// Statut
|
||||
|
||||
@ -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 "</tr>\n";
|
||||
|
||||
|
||||
@ -149,29 +149,10 @@ if ($id > 0 || ! empty($ref))
|
||||
else print' ';
|
||||
print '</td></tr>';
|
||||
|
||||
// Project leader
|
||||
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
|
||||
$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 '<br>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans('SharedProject');
|
||||
}
|
||||
// Visibility
|
||||
print '<tr><td>'.$langs->trans("Visibility").'</td><td>';
|
||||
if ($project->public) print $langs->trans('SharedProject');
|
||||
else print $langs->trans('Private');
|
||||
print '</td></tr>';
|
||||
|
||||
// Statut
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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 '<tr><td>'.$langs->trans("AffectedTo").'</td><td>';
|
||||
print $form->select_users($user->id,'userid',1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Date start
|
||||
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
|
||||
print $form->select_date('','dateo');
|
||||
@ -176,18 +176,18 @@ if ($_GET["action"] == 'create' && $user->rights->projet->task->creer && $userAc
|
||||
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
|
||||
print $form->select_date(-1,'datee');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Progress
|
||||
print '<tr><td>'.$langs->trans("Progress").'</td><td colspan="3">';
|
||||
print $formother->select_percent($task->progress,'progress');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Description
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td>';
|
||||
print '<td>';
|
||||
print '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'"></textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
$tasksarray=$task->getTasksArray(0, $user, 1);
|
||||
|
||||
print '<tr><td colspan="2" align="center">';
|
||||
@ -210,7 +210,7 @@ else
|
||||
*
|
||||
*/
|
||||
$userstatic=new User($db);
|
||||
|
||||
|
||||
$tab='tasks';
|
||||
if ($_REQUEST["mode"]=='mine') $tab='mytasks';
|
||||
|
||||
@ -236,36 +236,17 @@ else
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Project leader
|
||||
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
|
||||
$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 '<br>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans('SharedProject');
|
||||
}
|
||||
// Visibility
|
||||
print '<tr><td>'.$langs->trans("Visibility").'</td><td>';
|
||||
if ($project->public) print $langs->trans('SharedProject');
|
||||
else print $langs->trans('Private');
|
||||
print '</td></tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$project->getLibStatut(4).'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user