diff --git a/htdocs/core/actions_changeselectedfields.inc.php b/htdocs/core/actions_changeselectedfields.inc.php index 4cfc29209b1..6f2d863e143 100644 --- a/htdocs/core/actions_changeselectedfields.inc.php +++ b/htdocs/core/actions_changeselectedfields.inc.php @@ -28,7 +28,7 @@ // $object must be defined (object is loaded in this file with fetch) // Save selection -if (GETPOST('formfilteraction') == 'listafterchangingselectedfields') +if (GETPOST('formfilteraction','none') == 'listafterchangingselectedfields') { $tabparam=array(); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4f61435f124..3a4a2249de7 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6304,7 +6304,6 @@ class Form else $array[$key]['checked']=0; } } - //var_dump($array); $lis=''; $listcheckedstring=''; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 85f1cca98fd..23a5a6e2e7a 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1003,13 +1003,15 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) { $addcolspan=0; + if (! empty($arrayfields['t.planned_workload']['checked'])) $addcolspan++; + if (! empty($arrayfields['t.progress']['checked'])) $addcolspan++; foreach ($arrayfields as $key => $val) { if ($val['checked'] && substr($key, 0, 5) == 'efpt.') $addcolspan++; } print ''."\n"; - print ''; + print ''; print $projectstatic->getNomUrl(1, '', 0, ''.$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1); if ($projectstatic->title) @@ -1017,7 +1019,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr print ' - '; print $projectstatic->title; } - + /* $colspan=5+(empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:2); print ''; @@ -1077,6 +1079,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr print ''; print '
'; + */ print ''; print ''; } @@ -1093,14 +1096,20 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr */ // Project - /*print ""; - if ($oldprojectforbreak == -1) print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); - print "";*/ + if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) + { + print ""; + if ($oldprojectforbreak == -1) print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); + print ""; + } // Thirdparty - /*print ''; - if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project', 10); - print '';*/ + if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) + { + print ''; + if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project', 10); + print ''; + } // Ref print ''; @@ -1122,15 +1131,21 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Planned Workload - print ''; - if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin'); - else print '--:--'; - print ''; + if (! empty($arrayfields['t.planned_workload']['checked'])) + { + print ''; + if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin'); + else print '--:--'; + print ''; + } // Progress declared % - print ''; - print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress'); - print ''; + if (! empty($arrayfields['t.progress']['checked'])) + { + print ''; + print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress'); + print ''; + } // Time spent by everybody print ''; @@ -1368,13 +1383,15 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) { $addcolspan=0; + if (! empty($arrayfields['t.planned_workload']['checked'])) $addcolspan++; + if (! empty($arrayfields['t.progress']['checked'])) $addcolspan++; foreach ($arrayfields as $key => $val) { if ($val['checked'] && substr($key, 0, 5) == 'efpt.') $addcolspan++; } print ''."\n"; - print ''; + print ''; print $projectstatic->getNomUrl(1, '', 0, ''.$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1); if ($projectstatic->title) @@ -1383,7 +1400,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ print $projectstatic->title; } - $colspan=5+(empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:2); + /*$colspan=5+(empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:2); print ''; print ''; @@ -1441,6 +1458,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ print ''; print '
'; + */ print ''; print ''; @@ -1458,14 +1476,20 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ */ // Project - /*print ''; - if ($oldprojectforbreak == -1) print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); - print "";*/ + if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) + { + print ''; + if ($oldprojectforbreak == -1) print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); + print ""; + } // Thirdparty - /*print ''; - if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project'); - print '';*/ + if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) + { + print ''; + if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project'); + print ''; + } // Ref print ''; @@ -1487,17 +1511,22 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ $extrafieldsobjectprefix='efpt.'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Planned Workload - print ''; - if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin'); - else print '--:--'; - print ''; + if (! empty($arrayfields['t.planned_workload']['checked'])) + { + print ''; + if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin'); + else print '--:--'; + print ''; + } - // Progress declared % - print ''; - print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress'); - print ''; + if (! empty($arrayfields['t.progress']['checked'])) + { + // Progress declared % + print ''; + print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress'); + print ''; + } // Time spent by everybody print ''; diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 2a202e5f7c4..4f86613f556 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -63,12 +63,13 @@ $nowday=$nowtmp['mday']; $nowmonth=$nowtmp['mon']; $nowyear=$nowtmp['year']; -$year=GETPOST('reyear')?GETPOST('reyear'):(GETPOST("year", "int")?GETPOST("year", "int"):(GETPOST("addtimeyear", "int")?GETPOST("addtimeyear", "int"):date("Y"))); -$month=GETPOST('remonth')?GETPOST('remonth'):(GETPOST("month", "int")?GETPOST("month", "int"):(GETPOST("addtimemonth", "int")?GETPOST("addtimemonth", "int"):date("m"))); -$day=GETPOST('reday')?GETPOST('reday'):(GETPOST("day", "int")?GETPOST("day", "int"):(GETPOST("addtimeday", "int")?GETPOST("addtimeday", "int"):date("d"))); -$day = (int) $day; +$year=GETPOST('reyear', 'int')?GETPOST('reyear', 'int'):(GETPOST("year", "int")?GETPOST("year", "int"):(GETPOST("addtimeyear", "int")?GETPOST("addtimeyear", "int"):date("Y"))); +$month=GETPOST('remonth', 'int')?GETPOST('remonth', 'int'):(GETPOST("month", "int")?GETPOST("month", "int"):(GETPOST("addtimemonth", "int")?GETPOST("addtimemonth", "int"):date("m"))); +$day=GETPOST('reday', 'int')?GETPOST('reday', 'int'):(GETPOST("day", "int")?GETPOST("day", "int"):(GETPOST("addtimeday", "int")?GETPOST("addtimeday", "int"):date("d"))); $week=GETPOST("week", "int")?GETPOST("week", "int"):date("W"); +$day = (int) $day; + $search_categ=GETPOST("search_categ", 'alpha'); $search_usertoprocessid=GETPOST('search_usertoprocessid', 'int'); $search_task_ref=GETPOST('search_task_ref', 'alpha'); @@ -104,40 +105,44 @@ else $object=new Task($db); -$arrayfields=array( - // Project - 'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>103), - 'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>104), - 'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>105), - 'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110), - 'p.bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115), -); - // Extra fields $extrafields = new ExtraFields($db); +$extralabels = array(); // fetch optionals attributes and labels -$extralabels = $extrafields->fetch_name_optionals_label('projet'); -if (!empty($extrafields->attributes['projet']['label'])) -{ - foreach($extrafields->attributes['projet']['label'] as $key => $val) - { - if (! empty($extrafields->attributes['projet']['list'][$key])) $arrayfields["efp.".$key]=array('label'=>$extrafields->attributes['projet']['label'][$key], 'checked'=>(($extrafields->attributes['projet']['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes['projet']['pos'][$key], 'enabled'=>(abs($extrafields->attributes['projet']['list'][$key])!=3 && $extrafields->attributes['projet']['perms'][$key])); - } -} -$extralabels+= $extrafields->fetch_name_optionals_label('projet_task', true); -if (!empty($extrafields->attributes['projet_task']['label'])) +//$extralabels += $extrafields->fetch_name_optionals_label('projet'); +$extralabels += $extrafields->fetch_name_optionals_label('projet_task'); + +// Definition of fields for list +$arrayfields=array(); +$arrayfields['t.planned_workload']=array('label'=>'PlannedWorkload', 'checked'=>1, 'enabled'=>1, 'position'=>0); +$arrayfields['t.progress']=array('label'=>'ProgressDeclared', 'checked'=>1, 'enabled'=>1, 'position'=>0); +/*$arrayfields=array( + // Project + 'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>103), + 'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>104), + 'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>105), + 'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110), + 'p.bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115), + ); + */ +// Extra fields +if (is_array($extrafields->attributes['projet_task']['label']) && count($extrafields->attributes['projet_task']['label']) > 0) { foreach($extrafields->attributes['projet_task']['label'] as $key => $val) { - if (! empty($extrafields->attributes['projet_task']['list'][$key])) $arrayfields["efpt.".$key]=array('label'=>$extrafields->attributes['projet_task']['label'][$key], 'checked'=>(($extrafields->attributes['projet_task']['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes['projet_task']['pos'][$key], 'enabled'=>(abs($extrafields->attributes['projet_task']['list'][$key])!=3 && $extrafields->attributes['projet_task']['perms'][$key])); + if (! empty($extrafields->attributes['projet_task']['list'][$key])) + $arrayfields["efpt.".$key]=array('label'=>$extrafields->attributes['projet_task']['label'][$key], 'checked'=>(($extrafields->attributes['projet_task']['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes['projet_task']['pos'][$key], 'enabled'=>(abs($extrafields->attributes['projet_task']['list'][$key])!=3 && $extrafields->attributes['projet_task']['perms'][$key])); } } +$arrayfields = dol_sort_array($arrayfields, 'position'); + $search_array_options=array(); $search_array_options_project=$extrafields->getOptionalsFromPost('projet', '', 'search_'); $search_array_options_task=$extrafields->getOptionalsFromPost('projet_task', '', 'search_task_'); + /* * Actions */ @@ -286,7 +291,10 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac foreach($timespent_duration as $key => $val) { $object->fetch($key); - $object->progress = GETPOST($key.'progress', 'int'); + + if (GETPOSTISSET($taskid . 'progress')) $object->progress = GETPOST($taskid . 'progress', 'int'); + else unset($object->progress); + $object->timespent_duration = $val; $object->timespent_fk_user = $usertoprocess->id; $object->timespent_note = GETPOST($key.'note'); @@ -382,12 +390,12 @@ if ($search_declared_progress) $morewherefilter.=natural_search("t.progress", $ $sql = &$morewherefilter; -$search_array_options = $search_array_options_project; +/*$search_array_options = $search_array_options_project; $extrafieldsobjectprefix='efp.'; $search_options_pattern='search_options_'; $extrafieldsobjectkey='projet'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; - +*/ $search_array_options = $search_array_options_task; $extrafieldsobjectprefix='efpt.'; $search_options_pattern='search_task_options_'; @@ -410,28 +418,22 @@ llxHeader("", $title, "", '', '', '', array('/core/js/timesheet.js')); //print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project'); $param=''; -$param.=($mode?'&mode='.$mode:''); -$param.=($search_project_ref?'&search_project_ref='.$search_project_ref:''); -$param.=($search_usertoprocessid?'&search_usertoprocessid='.$search_usertoprocessid:''); -$param.=($search_thirdparty?'&search_thirdparty='.$search_thirdparty:''); -$param.=($search_task_ref?'&search_task_ref='.$search_task_ref:''); -$param.=($search_task_label?'&search_task_label='.$search_task_label:''); +$param.=($mode?'&mode='.urlencode($mode):''); +$param.=($search_project_ref?'&search_project_ref='.urlencode($search_project_ref):''); +$param.=($search_usertoprocessid?'&search_usertoprocessid='.urlencode($search_usertoprocessid):''); +$param.=($search_thirdparty?'&search_thirdparty='.urlencode($search_thirdparty):''); +$param.=($search_task_ref?'&search_task_ref='.urlencode($search_task_ref):''); +$param.=($search_task_label?'&search_task_label='.urlencode($search_task_label):''); -$search_array_options=$search_array_options_project; +/*$search_array_options=$search_array_options_project; $search_options_pattern='search_options_'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; +*/ $search_array_options=$search_array_options_task; $search_options_pattern='search_task_options_'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; -// Project -//$search_pattern='search_options_'; -//include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; -// Task -$search_options_pattern='search_task_options_'; -include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; - // Show navigation bar $nav =''.img_previous($langs->trans("Previous"))."\n"; $nav.=dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "%A").' '; @@ -539,6 +541,17 @@ if (! empty($moreforfilter)) print ''; } +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + +// This must be after the $selectedfields +$addcolspan=0; +if (! empty($arrayfields['t.planned_workload']['checked'])) $addcolspan++; +if (! empty($arrayfields['t.progress']['checked'])) $addcolspan++; +foreach ($arrayfields as $key => $val) +{ + if ($val['checked'] && substr($key, 0, 5) == 'efpt.') $addcolspan++; +} print '
'; print ''."\n"; @@ -547,26 +560,20 @@ print ''; if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ''; if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ''; print ''; - -$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; -$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - -$addcolspan=0; -foreach ($arrayfields as $key => $val) -{ - if ($val['checked'] && substr($key, 0, 5) == 'efpt.') $addcolspan++; -} - // TASK fields $search_options_pattern='search_task_options_'; $extrafieldsobjectkey='projet_task'; $extrafieldsobjectprefix='efpt.'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; - - -print ''; -print ''; print ''; +if (! empty($arrayfields['t.planned_workload']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['t.progress']['checked'])) +{ + print ''; +} print ''; print ''; print ''; @@ -582,20 +589,23 @@ print ''; if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ''; if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ''; print ''; - // TASK fields $extrafieldsobjectkey='projet_task'; $extrafieldsobjectprefix='efpt.'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; - - -print ''; -print ''; +if (! empty($arrayfields['t.planned_workload']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['t.progress']['checked'])) +{ + print ''; +} /*print ''; if ($usertoprocess->id == $user->id) print ''; else print '';*/ print ''; -print ''; +print ''; print ''; // By default, we can edit only tasks we are assigned to @@ -640,7 +650,7 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $ print "\n"; -$colspan = 6+(empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:2); +$colspan=4+(empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:2); if ($conf->use_javascript_ajax) { @@ -668,9 +678,9 @@ if ($conf->use_javascript_ajax) print ''; - print ' - - '; + print ''; + print ''; + print ''; } diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index a54538de6f6..8ad21746a68 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -63,12 +63,13 @@ $nowday=$nowtmp['mday']; $nowmonth=$nowtmp['mon']; $nowyear=$nowtmp['year']; -$year=GETPOST('reyear')?GETPOST('reyear', 'int'):(GETPOST("year")?GETPOST("year", "int"):date("Y")); -$month=GETPOST('remonth')?GETPOST('remonth', 'int'):(GETPOST("month")?GETPOST("month", "int"):date("m")); -$day=GETPOST('reday')?GETPOST('reday', 'int'):(GETPOST("day")?GETPOST("day", "int"):date("d")); -$day = (int) $day; +$year=GETPOST('reyear', 'int')?GETPOST('reyear', 'int'):(GETPOST("year", 'int')?GETPOST("year", "int"):date("Y")); +$month=GETPOST('remonth', 'int')?GETPOST('remonth', 'int'):(GETPOST("month", 'int')?GETPOST("month", "int"):date("m")); +$day=GETPOST('reday', 'int')?GETPOST('reday', 'int'):(GETPOST("day", 'int')?GETPOST("day", "int"):date("d")); $week=GETPOST("week", "int")?GETPOST("week", "int"):date("W"); +$day = (int) $day; + $search_categ=GETPOST("search_categ", 'alpha'); $search_usertoprocessid=GETPOST('search_usertoprocessid', 'int'); $search_task_ref=GETPOST('search_task_ref', 'alpha'); @@ -115,39 +116,48 @@ else $object=new Task($db); -$arrayfields=array( +// Extra fields +$extrafields = new ExtraFields($db); + +$extralabels = array(); +// fetch optionals attributes and labels +//$extralabels += $extrafields->fetch_name_optionals_label('projet'); +$extralabels += $extrafields->fetch_name_optionals_label('projet_task'); + +$arrayfields=array(); +/*$arrayfields=array( // Project 'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>103), 'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>104), 'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>105), 'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110), 'p.bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115), -); +);*/ +$arrayfields['t.planned_workload']=array('label'=>'PlannedWorkload', 'checked'=>1, 'enabled'=>1, 'position'=>0); +$arrayfields['t.progress']=array('label'=>'ProgressDeclared', 'checked'=>1, 'enabled'=>1, 'position'=>0); +/*foreach($object->fields as $key => $val) +{ + // If $val['visible']==0, then we never show the field + if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']); +}*/ +// Definition of fields for list // Extra fields -$extrafields = new ExtraFields($db); - -// fetch optionals attributes and labels -$extralabels = $extrafields->fetch_name_optionals_label('projet'); -if (!empty($extrafields->attributes['projet']['label'])) +if (is_array($extrafields->attributes['projet_task']['label']) && count($extrafields->attributes['projet_task']['label']) > 0) { - foreach($extrafields->attributes['projet']['label'] as $key => $val) - { - if (! empty($extrafields->attributes['projet']['list'][$key])) $arrayfields["efp.".$key]=array('label'=>$extrafields->attributes['projet']['label'][$key], 'checked'=>(($extrafields->attributes['projet']['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes['projet']['pos'][$key], 'enabled'=>(abs($extrafields->attributes['projet']['list'][$key])!=3 && $extrafields->attributes['projet']['perms'][$key])); - } -} -$extralabels+= $extrafields->fetch_name_optionals_label('projet_task', true); -if (!empty($extrafields->attributes['projet_task']['label'])) -{ - foreach($extrafields->attributes['projet_task']['label'] as $key => $val) - { - if (! empty($extrafields->attributes['projet_task']['list'][$key])) $arrayfields["efpt.".$key]=array('label'=>$extrafields->attributes['projet_task']['label'][$key], 'checked'=>(($extrafields->attributes['projet_task']['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes['projet_task']['pos'][$key], 'enabled'=>(abs($extrafields->attributes['projet_task']['list'][$key])!=3 && $extrafields->attributes['projet_task']['perms'][$key])); - } + foreach($extrafields->attributes['projet_task']['label'] as $key => $val) + { + if (! empty($extrafields->attributes['projet_task']['list'][$key])) + $arrayfields["efpt.".$key]=array('label'=>$extrafields->attributes['projet_task']['label'][$key], 'checked'=>(($extrafields->attributes['projet_task']['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes['projet_task']['pos'][$key], 'enabled'=>(abs($extrafields->attributes['projet_task']['list'][$key])!=3 && $extrafields->attributes['projet_task']['perms'][$key])); + } } +$arrayfields = dol_sort_array($arrayfields, 'position'); $search_array_options=array(); $search_array_options_project=$extrafields->getOptionalsFromPost('projet', '', 'search_'); $search_array_options_task=$extrafields->getOptionalsFromPost('projet_task', '', 'search_task_'); + + /* * Actions */ @@ -288,7 +298,10 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac if ($newduration > 0) { $object->fetch($taskid); - $object->progress = GETPOST($taskid . 'progress', 'int'); + + if (GETPOSTISSET($taskid . 'progress')) $object->progress = GETPOST($taskid . 'progress', 'int'); + else unset($object->progress); + $object->timespent_duration = $newduration; $object->timespent_fk_user = $usertoprocess->id; $object->timespent_date = dol_time_plus_duree($firstdaytoshow, $key, 'd'); @@ -330,20 +343,21 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); $param=''; - $param.=($mode?'&mode='.$mode:''); - $param.=($projectid?'id='.$projectid:''); - $param.=($search_usertoprocessid?'&search_usertoprocessid='.$search_usertoprocessid:''); - $param.=($day?'&day='.$day:'').($month?'&month='.$month:'').($year?'&year='.$year:''); - $param.=($search_project_ref?'&search_project_ref='.$search_project_ref:''); - $param.=($search_usertoprocessid > 0?'&search_usertoprocessid='.$search_usertoprocessid:''); - $param.=($search_thirdparty?'&search_thirdparty='.$search_thirdparty:''); - $param.=($search_declared_progress?'&search_declared_progress='.$search_declared_progress:''); - $param.=($search_task_ref?'&search_task_ref='.$search_task_ref:''); - $param.=($search_task_label?'&search_task_label='.$search_task_label:''); + $param.=($mode?'&mode='.urlencode($mode):''); + $param.=($projectid?'id='.urlencode($projectid):''); + $param.=($search_usertoprocessid?'&search_usertoprocessid='.urlencode($search_usertoprocessid):''); + $param.=($day?'&day='.urlencode($day):'').($month?'&month='.urlencode($month):'').($year?'&year='.urlencode($year):''); + $param.=($search_project_ref?'&search_project_ref='.urlencode($search_project_ref):''); + $param.=($search_usertoprocessid > 0?'&search_usertoprocessid='.urlencode($search_usertoprocessid):''); + $param.=($search_thirdparty?'&search_thirdparty='.urlencode($search_thirdparty):''); + $param.=($search_declared_progress?'&search_declared_progress='.urlencode($search_declared_progress):''); + $param.=($search_task_ref?'&search_task_ref='.urlencode($search_task_ref):''); + $param.=($search_task_label?'&search_task_label='.urlencode($search_task_label):''); - $search_array_options=$search_array_options_project; + /*$search_array_options=$search_array_options_project; $search_options_pattern='search_options_'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + */ $search_array_options=$search_array_options_task; $search_options_pattern='search_task_options_'; @@ -393,12 +407,12 @@ if ($search_declared_progress) $morewherefilter.=natural_search("t.progress", $ $sql = &$morewherefilter; -$search_array_options = $search_array_options_project; +/*$search_array_options = $search_array_options_project; $extrafieldsobjectprefix='efp.'; $search_options_pattern='search_options_'; $extrafieldsobjectkey='projet'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; - +*/ $search_array_options = $search_array_options_task; $extrafieldsobjectprefix='efpt.'; $search_options_pattern='search_task_options_'; @@ -422,12 +436,12 @@ llxHeader("", $title, "", '', '', '', array('/core/js/timesheet.js')); //print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project'); $param=''; -$param.=($mode?'&mode='.$mode:''); -$param.=($search_project_ref?'&search_project_ref='.$search_project_ref:''); -$param.=($search_usertoprocessid > 0?'&search_usertoprocessid='.$search_usertoprocessid:''); -$param.=($search_thirdparty?'&search_thirdparty='.$search_thirdparty:''); -$param.=($search_task_ref?'&search_task_ref='.$search_task_ref:''); -$param.=($search_task_label?'&search_task_label='.$search_task_label:''); +$param.=($mode?'&mode='.urlencode($mode):''); +$param.=($search_project_ref?'&search_project_ref='.urlencode($search_project_ref):''); +$param.=($search_usertoprocessid > 0?'&search_usertoprocessid='.urlencode($search_usertoprocessid):''); +$param.=($search_thirdparty?'&search_thirdparty='.urlencode($search_thirdparty):''); +$param.=($search_task_ref?'&search_task_ref='.urlencode($search_task_ref):''); +$param.=($search_task_label?'&search_task_label='.urlencode($search_task_label):''); $search_array_options=$search_array_options_project; $search_options_pattern='search_options_'; @@ -437,13 +451,6 @@ $search_array_options=$search_array_options_task; $search_options_pattern='search_task_options_'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; -// Project -//$search_pattern='search_options_'; -//include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; -// Task -$search_options_pattern='search_task_options_'; -include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; - // Show navigation bar $nav =''.img_previous($langs->trans("Previous"))."\n"; $nav.=" ".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("WeekShort")." ".$week." \n"; @@ -506,7 +513,6 @@ print ''; print '
'; - $startday=dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray['first_day'], $startdayarray['first_year']); // Get if user is available or not for each day @@ -584,6 +590,20 @@ if (! empty($moreforfilter)) print ''; } + +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + +$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + +// This must be after the $selectedfields +$addcolspan=0; +if (! empty($arrayfields['t.planned_workload']['checked'])) $addcolspan++; +if (! empty($arrayfields['t.progress']['checked'])) $addcolspan++; +foreach ($arrayfields as $key => $val) +{ + if ($val['checked'] && substr($key, 0, 5) == 'efpt.') $addcolspan++; +} + print '
'; print '
'.$langs->trans("Project").''.$langs->trans("ThirdParty").''.$langs->trans("Task").''.$langs->trans("PlannedWorkload").''.$langs->trans("ProgressDeclared").''.$langs->trans("PlannedWorkload").''.$langs->trans("ProgressDeclared").''.$langs->trans("TimeSpent").''.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.$langs->trans("TimeSpent").'
('.$langs->trans("Everybody").')
'.$langs->trans("TimeSpent").($usertoprocess->firstname?'
('.$usertoprocess->firstname.')':'').'
'.$langs->trans("TimeSpent").($usertoprocess->firstname?'
('.dol_trunc($usertoprocess->firstname,10).')':'').'
'.$langs->trans("HourStart").'
 
'."\n"; @@ -591,26 +611,20 @@ print ''; if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ''; if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ''; print ''; - -$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; -$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - -$addcolspan=0; -foreach ($arrayfields as $key => $val) -{ - if ($val['checked'] && substr($key, 0, 5) == 'efpt.') $addcolspan++; -} - // TASK fields $search_options_pattern='search_task_options_'; $extrafieldsobjectkey='projet_task'; $extrafieldsobjectprefix='efpt.'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; - - -print ''; -print ''; print ''; +if (! empty($arrayfields['t.planned_workload']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['t.progress']['checked'])) +{ + print ''; +} print ''; for ($idw=0;$idw<7;$idw++) { @@ -627,20 +641,23 @@ print ''; if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ''; if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ''; print ''; - // TASK fields $extrafieldsobjectkey='projet_task'; $extrafieldsobjectprefix='efpt.'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; - - -print ''; -print ''; +if (! empty($arrayfields['t.planned_workload']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['t.progress']['checked'])) +{ + print ''; +} /*print ''; if ($usertoprocess->id == $user->id) print ''; else print '';*/ print ''; -print ''; +print ''; for ($idw=0; $idw<7; $idw++) { @@ -668,7 +685,7 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $ print "\n"; -$colspan=5+(empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:2); +$colspan=3+(empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:2); if ($conf->use_javascript_ajax) { diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index 38d1c91a125..69ced3490ae 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -48,7 +48,7 @@ $colorbacklineimpair2='255,255,255'; // line impair $colorbacklinepair1='250,250,250'; // line pair $colorbacklinepair2='250,250,250'; // line pair $colorbacklinepairhover='230,237,244'; // line hover -$colorbacklinebreak='239,231,224'; // line break +$colorbacklinebreak='223,218,220'; // line break $colorbackbody='255,255,255'; $colortexttitlenotab='100,60,20'; $colortexttitle='0,0,0';
'.$langs->trans("Project").''.$langs->trans("ThirdParty").''.$langs->trans("Task").''.$langs->trans("PlannedWorkload").''.$langs->trans("ProgressDeclared").''.$langs->trans("PlannedWorkload").''.$langs->trans("ProgressDeclared").''.$langs->trans("TimeSpent").''.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.$langs->trans("TimeSpent").'
('.$langs->trans("Everybody").')
'.$langs->trans("TimeSpent").($usertoprocess->firstname?'
('.$usertoprocess->firstname.')':'').'
'.$langs->trans("TimeSpent").($usertoprocess->firstname?'
('.dol_trunc($usertoprocess->firstname,10).')':'').'