2
0
forked from Wavyzz/dolibarr

Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into

develop
This commit is contained in:
Laurent Destailleur
2024-03-28 10:55:44 +01:00
parent 1ce34cd5f3
commit a2ec7400eb
5 changed files with 71 additions and 44 deletions

View File

@@ -2937,7 +2937,7 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
$out .= '</span>';
$out .= ' <div class="progress sm '.$spaced.'">';
$out .= ' <div class="progress sm'.($spaced ? $spaced : '').'">';
$diffval = (float) $task->progress - (float) $progressCalculated;
if ($diffval >= 0) {
// good

View File

@@ -2483,11 +2483,12 @@ class Task extends CommonObjectLine
//$return .= '<br><span class="info-box-label amount">'.$langs->trans("Budget").' : '.price($this->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).'</span>';
}
if (property_exists($this, 'duration_effective')) {
$return .= '<br><br><div class="info-box-label progressinkanban">'.getTaskProgressView($this, false, true).'</div>';
$return .= '<br><div class="info-box-label progressinkanban paddingtop">'.getTaskProgressView($this, false, true).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}

View File

@@ -46,8 +46,15 @@ $langs->loadLangs($langsLoad);
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOSTINT('show_files');
//$show_files = GETPOSTINT('show_files');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'projecttasklist';
$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used
//$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used
//$backtopagejsfields = GETPOST('backtopagejsfields', 'alpha');
$optioncss = GETPOST('optioncss', 'aZ');
$backtopage = GETPOST('backtopage', 'alpha');
$toselect = GETPOST('toselect', 'array');
$id = GETPOSTINT('id');
@@ -66,9 +73,6 @@ $offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
$backtopage = GETPOST('backtopage', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$search_user_id = GETPOSTINT('search_user_id');
$search_taskref = GETPOST('search_taskref');
$search_tasklabel = GETPOST('search_tasklabel');
@@ -103,8 +107,6 @@ $search_date_end_endyear = GETPOSTINT('search_date_end_endyear');
$search_date_end_endday = GETPOSTINT('search_date_end_endday');
$search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear); // Use tzserver
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'projecttasklist';
$optioncss = GETPOST('optioncss', 'aZ');
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$object = new Project($db);
@@ -147,9 +149,13 @@ $progress = GETPOSTINT('progress');
$budget_amount = GETPOSTFLOAT('budget_amount');
$label = GETPOST('label', 'alpha');
$description = GETPOST('description', 'restricthtml');
$planned_workloadhour = (GETPOSTINT('planned_workloadhour') ? GETPOSTINT('planned_workloadhour') : 0);
$planned_workloadmin = (GETPOSTINT('planned_workloadmin') ? GETPOSTINT('planned_workloadmin') : 0);
$planned_workload = $planned_workloadhour * 3600 + $planned_workloadmin * 60;
$planned_workloadhour = (GETPOSTISSET('planned_workloadhour') ? GETPOSTINT('planned_workloadhour') : '');
$planned_workloadmin = (GETPOSTISSET('planned_workloadmin') ? GETPOSTINT('planned_workloadmin') : '');
if (GETPOSTISSET('planned_workloadhour') || GETPOSTISSET('planned_workloadmin')) {
$planned_workload = (int) $planned_workloadhour * 3600 + (int) $planned_workloadmin * 60;
} else {
$planned_workload = '';
}
// Definition of fields for list
$arrayfields = array(
@@ -186,7 +192,14 @@ $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
* Actions
*/
if (GETPOST('cancel', 'alpha')) {
if ($cancel) {
if (!empty($backtopageforcancel)) {
header("Location: ".$backtopageforcancel);
exit;
} elseif (!empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
$action = 'list';
$massaction = '';
}
@@ -797,7 +810,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object-
// Planned workload
print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td>';
print img_picto('', 'clock', 'class="pictofixedwidth"');
print $form->select_duration('planned_workload', !empty($planned_workload) ? $planned_workload : 0, 0, 'text');
print $form->select_duration('planned_workload', $planned_workload, 0, 'text');
print '</td></tr>';
// Progress

View File

@@ -155,20 +155,20 @@ if (empty($user->socid)) {
}
$arrayfields = array(
't.ref' => array('label' => "RefTask", 'checked' => 1, 'position' => 50),
't.fk_task_parent' => array('label' => "RefTaskParent", 'checked' => 0, 'position' => 70),
't.ref' => array('label' => "RefTask", 'checked' => 1, 'position' => 80),
't.label' => array('label' => "LabelTask", 'checked' => 1, 'position' => 80),
't.label' => array('label' => "LabelTask", 'checked' => 1, 'position' => 75),
't.description' => array('label' => "Description", 'checked' => 0, 'position' => 80),
't.dateo' => array('label' => "DateStart", 'checked' => 1, 'position' => 100),
't.datee' => array('label' => "Deadline", 'checked' => 1, 'position' => 101),
'p.ref' => array('label' => "ProjectRef", 'checked' => 1, 'position' => 151),
'p.title' => array('label' => "ProjectLabel", 'checked' => 0, 'position' => 152),
's.nom' => array('label' => "ThirdParty", 'checked' => 1, 'csslist' => 'tdoverflowmax125', 'position' => 200),
's.nom' => array('label' => "ThirdParty", 'checked' => -1, 'csslist' => 'tdoverflowmax125', 'position' => 200),
's.name_alias' => array('label' => "AliasNameShort", 'checked' => 0, 'csslist' => 'tdoverflowmax125', 'position' => 201),
'p.fk_statut' => array('label' => "ProjectStatus", 'checked' => 1, 'position' => 205),
't.planned_workload' => array('label' => "PlannedWorkload", 'checked' => 1, 'position' => 302),
't.duration_effective' => array('label' => "TimeSpent", 'checked' => 1, 'position' => 303),
't.progress_calculated' => array('label' => "ProgressCalculated", 'checked' => 1, 'position' => 304),
't.progress_calculated' => array('label' => "ProgressCalculated", 'checked' => -1, 'position' => 304),
't.progress' => array('label' => "ProgressDeclared", 'checked' => 1, 'position' => 305),
't.progress_summary' => array('label' => "TaskProgressSummary", 'checked' => 1, 'position' => 306),
't.budget_amount' => array('label' => "Budget", 'checked' => 0, 'position' => 307),
@@ -746,7 +746,7 @@ $newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition'));
$newcardbutton .= dolGetButtonTitleSeparator();
$newcardbutton .= dolGetButtonTitle($langs->trans('NewTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create', '', $permissiontocreate);
$newcardbutton .= dolGetButtonTitle($langs->trans('NewTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create&backtopage='.urlencode(DOL_URL_ROOT.'/projet/tasks/list.php'), '', $permissiontocreate);
// Show description of content
@@ -853,16 +853,16 @@ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print $searchpicto;
print '</td>';
}
if (!empty($arrayfields['t.fk_task_parent']['checked'])) {
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_task_ref_parent" value="'.dol_escape_htmltag($search_task_ref_parent).'" size="4">';
print '</td>';
}
if (!empty($arrayfields['t.ref']['checked'])) {
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'" size="4">';
print '</td>';
}
if (!empty($arrayfields['t.fk_task_parent']['checked'])) {
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_task_ref_parent" value="'.dol_escape_htmltag($search_task_ref_parent).'" size="4">';
print '</td>';
}
if (!empty($arrayfields['t.label']['checked'])) {
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'" size="8">';
@@ -1011,14 +1011,14 @@ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.fk_task_parent']['checked'])) {
print_liste_field_titre($arrayfields['t.fk_task_parent']['label'], $_SERVER["PHP_SELF"], "t.fk_task_parent", "", $param, "", $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.ref']['checked'])) {
print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], "t.ref", "", $param, "", $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.fk_task_parent']['checked'])) {
print_liste_field_titre($arrayfields['t.fk_task_parent']['label'], $_SERVER["PHP_SELF"], "t.fk_task_parent", "", $param, "", $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.label']['checked'])) {
print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER["PHP_SELF"], "t.label", "", $param, "", $sortfield, $sortorder);
$totalarray['nbfield']++;
@@ -1141,7 +1141,6 @@ while ($i < $imaxinloop) {
$object->ref = $obj->ref;
$object->label = $obj->label;
$object->description = $obj->description;
$object->fk_statut = $obj->status;
$object->status = $obj->status;
$object->progress = $obj->progress;
$object->budget_amount = $obj->budget_amount;
@@ -1207,6 +1206,18 @@ while ($i < $imaxinloop) {
$totalarray['nbfield']++;
}
}
// Ref
if (!empty($arrayfields['t.ref']['checked'])) {
print '<td class="nowraponall">';
print $object->getNomUrl(1, 'withproject');
if ($object->hasDelay()) {
print img_warning("Late");
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Ref Parent
if (!empty($arrayfields['t.fk_task_parent']['checked'])) {
print '<td class="nowraponall">';
@@ -1227,18 +1238,6 @@ while ($i < $imaxinloop) {
$totalarray['nbfield']++;
}
}
// Ref
if (!empty($arrayfields['t.ref']['checked'])) {
print '<td class="nowraponall">';
print $object->getNomUrl(1, 'withproject');
if ($object->hasDelay()) {
print img_warning("Late");
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Label
if (!empty($arrayfields['t.label']['checked'])) {
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($object->label).'">';
@@ -1383,6 +1382,15 @@ while ($i < $imaxinloop) {
} else {
print '</a>';
}
if (empty($arrayfields['t.progress_calculated']['checked'])) {
if ($obj->planned_workload || $obj->duration_effective) {
if ($obj->planned_workload) {
print ' <span class="opacitymedium">('.round(100 * $obj->duration_effective / $obj->planned_workload, 2).' %)</span>';
} else {
print $form->textwithpicto('', $langs->trans('WorkloadNotDefined'), 1, 'help');
}
}
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
@@ -1448,9 +1456,9 @@ while ($i < $imaxinloop) {
// Progress summary
if (!empty($arrayfields['t.progress_summary']['checked'])) {
print '<td class="center">';
if ($obj->progress != '' && $obj->duration_effective) {
//if ($obj->progress != '') {
print getTaskProgressView($object, false, false);
}
//}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;

View File

@@ -40,13 +40,18 @@ $langs->loadlangs(array('projects', 'companies'));
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
//$cancel = GETPOST('cancel', 'aZ09');
//$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
//$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used
//$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used
//$backtopagejsfields = GETPOST('backtopagejsfields', 'alpha');
$id = GETPOSTINT('id');
$ref = GETPOST("ref", 'alpha', 1); // task ref
$taskref = GETPOST("taskref", 'alpha'); // task ref
$withproject = GETPOSTINT('withproject');
$project_ref = GETPOST('project_ref', 'alpha');
$planned_workload = ((GETPOSTINT('planned_workloadhour') != '' || GETPOSTINT('planned_workloadmin') != '') ? (GETPOSTINT('planned_workloadhour') > 0 ? GETPOSTINT('planned_workloadhour') * 3600 : 0) + (GETPOSTINT('planned_workloadmin') > 0 ? GETPOSTINT('planned_workloadmin') * 60 : 0) : '');
$planned_workload = ((GETPOST('planned_workloadhour') != '' || GETPOST('planned_workloadmin') != '') ? (GETPOSTINT('planned_workloadhour') > 0 ? GETPOSTINT('planned_workloadhour') * 3600 : 0) + (GETPOSTINT('planned_workloadmin') > 0 ? GETPOSTINT('planned_workloadmin') * 60 : 0) : '');
$mode = GETPOST('mode', 'alpha');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@@ -611,7 +616,7 @@ if ($id > 0 || !empty($ref)) {
// Progress declared
print '<tr><td class="titlefield">'.$langs->trans("ProgressDeclared").'</td><td colspan="3">';
if ($object->progress != '') {
if ($object->progress != '' && $object->progress != '-1') {
print $object->progress.' %';
}
print '</td></tr>';