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
52e2fc71
Commit
52e2fc71
authored
15 years ago
by
Regis Houssin
Browse files
Options
Downloads
Patches
Plain Diff
Fix: management of time spent in task card
parent
d5d92914
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
htdocs/projet/activity/list.php
+0
-3
0 additions, 3 deletions
htdocs/projet/activity/list.php
htdocs/projet/tasks/task.class.php
+7
-0
7 additions, 0 deletions
htdocs/projet/tasks/task.class.php
htdocs/projet/tasks/time.php
+57
-15
57 additions, 15 deletions
htdocs/projet/tasks/time.php
with
64 additions
and
18 deletions
htdocs/projet/activity/list.php
+
0
−
3
View file @
52e2fc71
...
...
@@ -66,9 +66,6 @@ if ($_POST["action"] == 'addtime' && $user->rights->projet->creer)
{
if
(
$time
>
0
)
{
$time
=
intval
(
$time
)
+
((
$time
-
intval
(
$time
))
*
(
1
+
2
/
3
));
$time
=
price2num
(
$time
);
$id
=
str_replace
(
"task"
,
""
,
$key
);
$task
=
new
Task
(
$db
);
...
...
This diff is collapsed.
Click to expand it.
htdocs/projet/tasks/task.class.php
+
7
−
0
View file @
52e2fc71
...
...
@@ -596,17 +596,24 @@ class Task extends CommonObject
function
addTimeSpent
(
$user
,
$notrigger
=
0
)
{
$result
=
0
;
// Clean parameters
$this
->
timespent_duration
=
intval
(
$this
->
timespent_duration
)
+
((
$this
->
timespent_duration
-
intval
(
$this
->
timespent_duration
))
*
(
1
+
2
/
3
));
$this
->
timespent_duration
=
price2num
(
$this
->
timespent_duration
);
if
(
isset
(
$this
->
timespent_note
))
$this
->
timespent_note
=
trim
(
$this
->
timespent_note
);
$sql
=
"INSERT INTO "
.
MAIN_DB_PREFIX
.
"projet_task_time ("
;
$sql
.
=
"fk_task"
;
$sql
.
=
", task_date"
;
$sql
.
=
", task_duration"
;
$sql
.
=
", fk_user"
;
$sql
.
=
", note"
;
$sql
.
=
") VALUES ("
;
$sql
.
=
$this
->
id
;
$sql
.
=
", '"
.
$this
->
db
->
idate
(
$this
->
timespent_date
)
.
"'"
;
$sql
.
=
", "
.
$this
->
timespent_duration
;
$sql
.
=
", "
.
$user
->
id
;
$sql
.
=
", "
.
(
isset
(
$this
->
timespent_note
)
?
"'"
.
addslashes
(
$this
->
timespent_note
)
.
"'"
:
"null"
);
$sql
.
=
")"
;
dol_syslog
(
get_class
(
$this
)
.
"::addTimeSpent sql="
.
$sql
,
LOG_DEBUG
);
...
...
This diff is collapsed.
Click to expand it.
htdocs/projet/tasks/time.php
+
57
−
15
View file @
52e2fc71
...
...
@@ -33,6 +33,27 @@ if (!$user->rights->projet->lire) accessforbidden();
/*
* Actions
*/
if
(
$_POST
[
"action"
]
==
'addtimespent'
&&
$user
->
rights
->
projet
->
creer
)
{
if
(
$_POST
[
"timespent_note"
]
&&
$_POST
[
"timespent_duration"
])
{
$task
=
new
Task
(
$db
);
$task
->
fetch
(
$_POST
[
"id"
]);
$task
->
timespent_note
=
$_POST
[
"timespent_note"
];
$task
->
timespent_duration
=
$_POST
[
"timespent_duration"
];
$task
->
timespent_date
=
dol_mktime
(
12
,
0
,
0
,
$_POST
[
"timemonth"
],
$_POST
[
"timeday"
],
$_POST
[
"timeyear"
]);
$task
->
addTimeSpent
(
$user
);
}
else
{
$langs
->
load
(
"errors"
);
$mesg
=
'<div class="error">'
.
$langs
->
trans
(
$task
->
error
)
.
'</div>'
;
$_POST
[
"action"
]
=
''
;
}
}
if
(
$_POST
[
"action"
]
==
'updateline'
&&
!
$_POST
[
"cancel"
]
&&
$user
->
rights
->
projet
->
creer
)
{
...
...
@@ -116,24 +137,45 @@ if ($_GET["id"] > 0)
print
'</table>'
;
print
'</div>'
;
/*
* A
ctions
* A
dd time spent
*/
print
'<div class="tabsAction">'
;
print
'<form method="POST" action="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?id='
.
$task
->
id
.
'">'
;
print
'<input type="hidden" name="token" value="'
.
$_SESSION
[
'newtoken'
]
.
'">'
;
print
'<input type="hidden" name="action" value="addtimespent">'
;
print
'<input type="hidden" name="id" value="'
.
$task
->
id
.
'">'
;
// Add time spent
if
(
$user
->
rights
->
projet
->
creer
&&
$userAccess
)
{
print
'<a class="butAction" href="'
.
$_SERVER
[
'PHP_SELF'
]
.
'?id='
.
$task
->
id
.
'&action=addtime">'
.
$langs
->
trans
(
'NewTimeSpent'
)
.
'</a>'
;
}
else
{
print
'<a class="butActionRefused" href="#" title="'
.
$langs
->
trans
(
"NotAllowed"
)
.
'">'
.
$langs
->
trans
(
'NewTimeSpent'
)
.
'</a>'
;
}
print
'</div>'
;
print
'<table class="noborder" width="100%">'
;
print
'<tr class="liste_titre">'
;
print
'<td>'
.
$langs
->
trans
(
"Note"
)
.
'</td>'
;
print
'<td>'
.
$langs
->
trans
(
"Date"
)
.
'</td>'
;
print
'<td colspan="2">'
.
$langs
->
trans
(
"Duration"
)
.
'</td>'
;
print
"</tr>
\n
"
;
print
'<tr>'
;
// Note
print
'<td nowrap="nowrap">'
;
print
'<textarea name="timespent_note" cols="80" rows="4"></textarea>'
;
print
'</td>'
;
// Date
print
'<td nowrap="nowrap">'
;
print
$html
->
select_date
(
''
,
'time'
,
''
,
''
,
''
,
"timespent_date"
);
print
'</td>'
;
// Duration
print
'<td nowrap="nowrap">'
;
print
'<input size="4" type="text" class="flat" name="timespent_duration" value="">'
;
print
'</td>'
;
print
'<td>'
;
print
'<input type="submit" class="button" value="'
.
$langs
->
trans
(
"Add"
)
.
'">'
;
print
'</td></tr>'
;
print
'</table></form>'
;
print
'<br>'
;
...
...
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