parent
5a4f2fa0b3
commit
c0a30d1ff5
@ -317,7 +317,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
$object->project = clone $projectstatic;
|
||||
}
|
||||
|
||||
$userWrite = $projectstatic->restrictedProjectArea($user,'write');
|
||||
$userRead = $projectstatic->restrictedProjectArea($user, 'read');
|
||||
$linktocreatetime = '';
|
||||
|
||||
if ($projectstatic->id > 0)
|
||||
{
|
||||
@ -427,33 +428,30 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
print '<br>';
|
||||
|
||||
// Link to create time
|
||||
//if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes))
|
||||
//{
|
||||
if ($user->rights->projet->all->creer || $user->rights->projet->creer)
|
||||
{
|
||||
if ($projectstatic->public || $userWrite > 0)
|
||||
{
|
||||
if (! empty($projectidforalltimes)) // We are on tab 'Time Spent' of project
|
||||
{
|
||||
$backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject?'&withproject=1':'');
|
||||
$linktocreatetime = '<a class="butActionNew" href="'.$_SERVER['PHP_SELF'].'?withproject=1&projectid='.$projectstatic->id.'&action=createtime'.$param.'&backtopage='.urlencode($backtourl).'">'.$langs->trans('AddTimeSpent').'<span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||
}
|
||||
else // We are on tab 'Time Spent' of task
|
||||
{
|
||||
$backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject?'&withproject=1':'');
|
||||
$linktocreatetime = '<a class="butActionNew" href="'.$_SERVER['PHP_SELF'].'?withproject=1'.($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime'.$param.'&backtopage='.urlencode($backtourl).'">'.$langs->trans('AddTimeSpent').'<span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$linktocreatetime = '<a class="butActionNewRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('AddTime').'<span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$linktocreatetime = '<a class="butActionNewRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('AddTime').'<span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||
}
|
||||
//}
|
||||
if ($user->rights->projet->all->lire || $user->rights->projet->lire)) // To enter time, read permission is enough
|
||||
{
|
||||
if ($projectstatic->public || $userRead > 0)
|
||||
{
|
||||
if (! empty($projectidforalltimes)) // We are on tab 'Time Spent' of project
|
||||
{
|
||||
$backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject?'&withproject=1':'');
|
||||
$linktocreatetime = '<a class="butActionNew" href="'.$_SERVER['PHP_SELF'].'?withproject=1&projectid='.$projectstatic->id.'&action=createtime'.$param.'&backtopage='.urlencode($backtourl).'">'.$langs->trans('AddTimeSpent').'<span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||
}
|
||||
else // We are on tab 'Time Spent' of task
|
||||
{
|
||||
$backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject?'&withproject=1':'');
|
||||
$linktocreatetime = '<a class="butActionNew" href="'.$_SERVER['PHP_SELF'].'?withproject=1'.($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime'.$param.'&backtopage='.urlencode($backtourl).'">'.$langs->trans('AddTimeSpent').'<span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$linktocreatetime = '<a class="butActionNewRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('AddTime').'<span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$linktocreatetime = '<a class="butActionNewRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('AddTime').'<span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -803,7 +801,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
|
||||
// Duration - Time spent
|
||||
print '<td>';
|
||||
print $form->select_duration('timespent_duration', ($_POST['timespent_duration']?$_POST['timespent_duration']:''), 0, 'text');
|
||||
$durationtouse = ($_POST['timespent_duration']?$_POST['timespent_duration']:'');
|
||||
if (GETPOSTISSET('timespent_durationhour') || GETPOSTISSET('timespent_durationmin'))
|
||||
{
|
||||
$durationtouse = (GETPOST('timespent_durationhour') * 3600 + GETPOST('timespent_durationmin') * 60);
|
||||
}
|
||||
print $form->select_duration('timespent_duration', $durationtouse, 0, 'text');
|
||||
print '</td>';
|
||||
|
||||
// Progress declared
|
||||
|
||||
Loading…
Reference in New Issue
Block a user