Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custonly checkbox #194

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf
$result = $ticket->fetch($object->fk_element);
dol_syslog(var_export($ticket, true), LOG_DEBUG);
if ($result > 0 && ($ticket->id) > 0) {
if (is_array($ticket->array_options) && array_key_exists('options_fk_task', $ticket->array_options) && $ticket->array_options['options_fk_task']>0) {
if (is_array($ticket->array_options) && array_key_exists('options_fk_task', $ticket->array_options) && $ticket->array_options['options_fk_task']>0 && !empty(GETPOST('timespent', 'int'))) {
require_once DOL_DOCUMENT_ROOT .'/projet/class/task.class.php';
$task = new Task($this->db);
$result = $task->fetch($ticket->array_options['options_fk_task']);
Expand Down
5 changes: 5 additions & 0 deletions view/timespent_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@
}
$sql .= ' AND ptt.task_duration IS NOT NULL';

if (GETPOST('custonly')) $sql .= ' AND s.rowid IS NOT NULL';

foreach ($search as $key => $val) {
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
if (preg_match('/_dtstart$/', $key)) {
Expand Down Expand Up @@ -401,6 +403,8 @@
$moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array);
}

$moreforfilter .= 'Client seulement : <input type="checkbox" name="custonly"' . (GETPOST('custonly') ? ' checked=checked' : ''). '>';

if (!empty($moreforfilter)) {
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
Expand Down Expand Up @@ -546,6 +550,7 @@
print $obj->{$key};
} elseif ($key == 'task_duration') {
print convertSecondToTime($obj->task_duration, 'allhourmin');
$totalarray['type'][$i]='duration';
} elseif ($key == 'thm') {
$value = price2num($obj->thm * $obj->task_duration / 3600, 'MT', 1);
print '<span class="amount" title="'.$langs->trans("THM").': '.price($obj->thm).'">';
Expand Down