Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
1016e05f
Commit
1016e05f
authored
10 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fix: visible task into area "time" for "My task" must limit task to
tasks i am assigned to.
parent
ebc11a7a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/core/lib/project.lib.php
+103
-97
103 additions, 97 deletions
htdocs/core/lib/project.lib.php
htdocs/projet/activity/list.php
+12
-6
12 additions, 6 deletions
htdocs/projet/activity/list.php
with
115 additions
and
103 deletions
htdocs/core/lib/project.lib.php
+
103
−
97
View file @
1016e05f
...
...
@@ -443,16 +443,17 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
/**
* Output a task line
*
* @param string &$inc ?
* @param string $parent ?
* @param Object $lines ?
* @param int &$level ?
* @param string &$projectsrole ?
* @param string &$tasksrole ?
* @param int $mytask 0 or 1 to enable only if task is a task i am affected to
* @param string &$inc ?
* @param string $parent ?
* @param Object $lines ?
* @param int &$level ?
* @param string &$projectsrole ?
* @param string &$tasksrole ?
* @param string $mine Show only task lines I am assigned to
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
* @return $inc
*/
function
projectLinesb
(
&
$inc
,
$parent
,
$lines
,
&
$level
,
&
$projectsrole
,
&
$tasksrole
,
$mytask
=
0
)
function
projectLinesb
(
&
$inc
,
$parent
,
$lines
,
&
$level
,
&
$projectsrole
,
&
$tasksrole
,
$
mine
,
$restricteditfor
mytask
=
0
)
{
global
$user
,
$bc
,
$langs
;
global
$form
,
$projectstatic
,
$taskstatic
;
...
...
@@ -475,99 +476,104 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
$lastprojectid
=
$lines
[
$i
]
->
fk_project
;
}
print
"<tr "
.
$bc
[
$var
]
.
">
\n
"
;
// Project
print
"<td>"
;
$projectstatic
->
id
=
$lines
[
$i
]
->
fk_project
;
$projectstatic
->
ref
=
$lines
[
$i
]
->
projectref
;
$projectstatic
->
public
=
$lines
[
$i
]
->
public
;
$projectstatic
->
label
=
$langs
->
transnoentitiesnoconv
(
"YourRole"
)
.
': '
.
$projectsrole
[
$lines
[
$i
]
->
fk_project
];
print
$projectstatic
->
getNomUrl
(
1
);
print
"</td>"
;
// Ref
print
'<td>'
;
$taskstatic
->
id
=
$lines
[
$i
]
->
id
;
$taskstatic
->
ref
=
$lines
[
$i
]
->
id
;
print
$taskstatic
->
getNomUrl
(
1
);
print
'</td>'
;
// Label task
print
"<td>"
;
for
(
$k
=
0
;
$k
<
$level
;
$k
++
)
// If we want all or we have a role on task, we show it
if
(
empty
(
$mine
)
||
!
empty
(
$tasksrole
[
$lines
[
$i
]
->
id
]))
{
print
" "
;
}
$taskstatic
->
id
=
$lines
[
$i
]
->
id
;
$taskstatic
->
ref
=
$lines
[
$i
]
->
label
;
print
$taskstatic
->
getNomUrl
(
0
);
print
"</td>
\n
"
;
// Date start
print
'<td align="center">'
;
print
dol_print_date
(
$lines
[
$i
]
->
date_start
,
'dayhour'
);
print
'</td>'
;
// Date end
print
'<td align="center">'
;
print
dol_print_date
(
$lines
[
$i
]
->
date_end
,
'dayhour'
);
print
'</td>'
;
// Planned Workload
print
'<td align="right">'
;
if
(
$lines
[
$i
]
->
planned_workload
)
print
convertSecondToTime
(
$lines
[
$i
]
->
planned_workload
,
'allhourmin'
);
else
print
'--:--'
;
print
'</td>'
;
// Progress declared %
print
'<td align="right">'
;
print
$lines
[
$i
]
->
progress
.
' %'
;
print
'</td>'
;
// Time spent
print
'<td align="right">'
;
if
(
$lines
[
$i
]
->
duration
)
{
print
'<a href="'
.
DOL_URL_ROOT
.
'/projet/tasks/time.php?id='
.
$lines
[
$i
]
->
id
.
'">'
;
print
convertSecondToTime
(
$lines
[
$i
]
->
duration
,
'allhourmin'
);
print
'</a>'
;
}
else
print
'--:--'
;
print
"</td>
\n
"
;
$disabledproject
=
1
;
$disabledtask
=
1
;
//print "x".$lines[$i]->fk_project;
//var_dump($lines[$i]);
//var_dump($projectsrole[$lines[$i]->fk_project]);
// If at least one role for project
if
(
$lines
[
$i
]
->
public
||
!
empty
(
$projectsrole
[
$lines
[
$i
]
->
fk_project
])
||
$user
->
rights
->
projet
->
all
->
creer
)
{
$disabledproject
=
0
;
$disabledtask
=
0
;
}
// If mytask and no role on task
if
(
$mytask
&&
empty
(
$tasksrole
[
$lines
[
$i
]
->
id
]))
{
$disabledtask
=
1
;
print
"<tr "
.
$bc
[
$var
]
.
">
\n
"
;
// Project
print
"<td>"
;
$projectstatic
->
id
=
$lines
[
$i
]
->
fk_project
;
$projectstatic
->
ref
=
$lines
[
$i
]
->
projectref
;
$projectstatic
->
public
=
$lines
[
$i
]
->
public
;
$projectstatic
->
label
=
$langs
->
transnoentitiesnoconv
(
"YourRole"
)
.
': '
.
$projectsrole
[
$lines
[
$i
]
->
fk_project
];
print
$projectstatic
->
getNomUrl
(
1
);
print
"</td>"
;
// Ref
print
'<td>'
;
$taskstatic
->
id
=
$lines
[
$i
]
->
id
;
$taskstatic
->
ref
=
$lines
[
$i
]
->
id
;
print
$taskstatic
->
getNomUrl
(
1
);
print
'</td>'
;
// Label task
print
"<td>"
;
for
(
$k
=
0
;
$k
<
$level
;
$k
++
)
{
print
" "
;
}
$taskstatic
->
id
=
$lines
[
$i
]
->
id
;
$taskstatic
->
ref
=
$lines
[
$i
]
->
label
;
print
$taskstatic
->
getNomUrl
(
0
);
print
"</td>
\n
"
;
// Date start
print
'<td align="center">'
;
print
dol_print_date
(
$lines
[
$i
]
->
date_start
,
'dayhour'
);
print
'</td>'
;
// Date end
print
'<td align="center">'
;
print
dol_print_date
(
$lines
[
$i
]
->
date_end
,
'dayhour'
);
print
'</td>'
;
// Planned Workload
print
'<td align="right">'
;
if
(
$lines
[
$i
]
->
planned_workload
)
print
convertSecondToTime
(
$lines
[
$i
]
->
planned_workload
,
'allhourmin'
);
else
print
'--:--'
;
print
'</td>'
;
// Progress declared %
print
'<td align="right">'
;
print
$lines
[
$i
]
->
progress
.
' %'
;
print
'</td>'
;
// Time spent
print
'<td align="right">'
;
if
(
$lines
[
$i
]
->
duration
)
{
print
'<a href="'
.
DOL_URL_ROOT
.
'/projet/tasks/time.php?id='
.
$lines
[
$i
]
->
id
.
'">'
;
print
convertSecondToTime
(
$lines
[
$i
]
->
duration
,
'allhourmin'
);
print
'</a>'
;
}
else
print
'--:--'
;
print
"</td>
\n
"
;
$disabledproject
=
1
;
$disabledtask
=
1
;
//print "x".$lines[$i]->fk_project;
//var_dump($lines[$i]);
//var_dump($projectsrole[$lines[$i]->fk_project]);
// If at least one role for project
if
(
$lines
[
$i
]
->
public
||
!
empty
(
$projectsrole
[
$lines
[
$i
]
->
fk_project
])
||
$user
->
rights
->
projet
->
all
->
creer
)
{
$disabledproject
=
0
;
$disabledtask
=
0
;
}
// If $restricteditformytask is on and I have no role on task, i disable edit
if
(
$restricteditformytask
&&
empty
(
$tasksrole
[
$lines
[
$i
]
->
id
]))
{
$disabledtask
=
1
;
}
print
'<td class="nowrap">'
;
$s
=
$form
->
select_date
(
''
,
$lines
[
$i
]
->
id
,
''
,
''
,
''
,
"addtime"
,
1
,
0
,
1
,
$disabledtask
);
$s
.
=
' '
;
$s
.
=
$form
->
select_duration
(
$lines
[
$i
]
->
id
,
''
,
$disabledtask
,
'text'
);
$s
.
=
' <input type="submit" class="button"'
.
(
$disabledtask
?
' disabled="disabled"'
:
''
)
.
' value="'
.
$langs
->
trans
(
"Add"
)
.
'">'
;
print
$s
;
print
'</td>'
;
print
'<td align="right">'
;
if
((
!
$lines
[
$i
]
->
public
)
&&
$disabledproject
)
print
$form
->
textwithpicto
(
''
,
$langs
->
trans
(
"YouAreNotContactOfProject"
));
else
if
(
$disabledtask
)
print
$form
->
textwithpicto
(
''
,
$langs
->
trans
(
"TaskIsNotAffectedToYou"
));
print
'</td>'
;
print
"</tr>
\n
"
;
}
print
'<td class="nowrap">'
;
$s
=
$form
->
select_date
(
''
,
$lines
[
$i
]
->
id
,
''
,
''
,
''
,
"addtime"
,
1
,
0
,
1
,
$disabledtask
);
$s
.
=
' '
;
$s
.
=
$form
->
select_duration
(
$lines
[
$i
]
->
id
,
''
,
$disabledtask
,
'text'
);
$s
.
=
' <input type="submit" class="button"'
.
(
$disabledtask
?
' disabled="disabled"'
:
''
)
.
' value="'
.
$langs
->
trans
(
"Add"
)
.
'">'
;
print
$s
;
print
'</td>'
;
print
'<td align="right">'
;
if
((
!
$lines
[
$i
]
->
public
)
&&
$disabledproject
)
print
$form
->
textwithpicto
(
''
,
$langs
->
trans
(
"YouAreNotContactOfProject"
));
else
if
(
$disabledtask
)
print
$form
->
textwithpicto
(
''
,
$langs
->
trans
(
"TaskIsNotAffectedToYou"
));
print
'</td>'
;
print
"</tr>
\n
"
;
$inc
++
;
$level
++
;
if
(
$lines
[
$i
]
->
id
)
projectLinesb
(
$inc
,
$lines
[
$i
]
->
id
,
$lines
,
$level
,
$projectsrole
,
$tasksrole
,
$mytask
);
if
(
$lines
[
$i
]
->
id
)
projectLinesb
(
$inc
,
$lines
[
$i
]
->
id
,
$lines
,
$level
,
$projectsrole
,
$tasksrole
,
$
mine
,
$restricteditfor
mytask
);
$level
--
;
}
else
...
...
This diff is collapsed.
Click to expand it.
htdocs/projet/activity/list.php
+
12
−
6
View file @
1016e05f
...
...
@@ -137,11 +137,14 @@ llxHeader("",$title,"");
print_barre_liste
(
$title
,
$page
,
$_SERVER
[
"PHP_SELF"
],
""
,
$sortfield
,
$sortorder
,
""
,
$num
);
// Filter on user
dol_fiche_head
(
''
);
print
'<table class="border" width="100%"><tr><td width="25%">'
.
$langs
->
trans
(
"User"
)
.
'</td>'
;
print
'<td>'
.
$user
->
getLoginUrl
(
1
)
.
'</td>'
;
print
'</tr></table>'
;
dol_fiche_end
();
/* dol_fiche_head('');
print '<table class="border" width="100%"><tr><td width="25%">'.$langs->trans("User").'</td>';
print '<td>';
if ($mine) print $user->getLoginUrl(1);
print '</td>';
print '</tr></table>';
dol_fiche_end();
*/
dol_htmloutput_mesg
(
$mesg
);
...
...
@@ -165,9 +168,12 @@ print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
print
'<td colspan="2">'
.
$langs
->
trans
(
"AddDuration"
)
.
'</td>'
;
print
"</tr>
\n
"
;
// By default, we can edit only tasks we are assigned to
$restricteditformytask
=
(
empty
(
$conf
->
global
->
PROJECT_TIME_ON_ALL_TASKS_MY_PROJECTS
)
?
1
:
0
);
if
(
count
(
$tasksarray
)
>
0
)
{
projectLinesb
(
$j
,
0
,
$tasksarray
,
$level
,
$projectsrole
,
$tasksrole
,
$mine
);
projectLinesb
(
$j
,
0
,
$tasksarray
,
$level
,
$projectsrole
,
$tasksrole
,
$mine
,
$restricteditformytask
);
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment