diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 6ba80304188..ce2bbc5381e 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -403,7 +403,7 @@ if ($id > 0 || ! empty($ref)) print ''; if ($nbcategories) { - print '
'.$langs->trans("Category").': '; + print '
'.$langs->trans("Rubrique").': '; } print ''; print ''; diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php index a1e114430ce..f367149a19c 100644 --- a/htdocs/compta/bank/search.php +++ b/htdocs/compta/bank/search.php @@ -178,9 +178,10 @@ if ($resql) print '
'."\n"; print ''."\n"; - $moreforfilter .= $langs->trans('Period') . ' ' . $langs->trans('StartDate') . ': '; - $moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 1, 1); - $moreforfilter .= $langs->trans('EndDate') . ':' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 1, 1); + $moreforfilter .= $langs->trans('Period') . ' ('.$langs->trans('DateOperationShort').') : ' . $langs->trans('StartDate') . ' '; + $moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1); + $moreforfilter .= ' - '; + $moreforfilter .= $langs->trans('EndDate') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1); if ($moreforfilter) { diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 63aca7c7e92..828c7c359d1 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -504,9 +504,10 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t * @param string $tasksrole Array of roles user has on task * @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 + * @param int $preselectedday Preselected day * @return $inc */ -function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0) +function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0, $preselectedday='') { global $db, $user, $bc, $langs; global $form, $formother, $projectstatic, $taskstatic; @@ -527,6 +528,12 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t { $var = !$var; $lastprojectid=$lines[$i]->fk_project; + + if ($preselectedday) + { + $projectstatic->id = $lines[$i]->fk_project; + $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent into this->weekWorkLoad and this->weekWorkLoadPerTaks for all day of a week + } } // If we want all or we have a role on task, we show it @@ -549,7 +556,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t // Ref print ''; $taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id); - print $taskstatic->getNomUrl(1); + print $taskstatic->getNomUrl(1,'withproject'); print ''; // Label task @@ -559,7 +566,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t $taskstatic->ref=$lines[$i]->label; $taskstatic->date_start=$lines[$i]->date_start; $taskstatic->date_end=$lines[$i]->date_end; - print $taskstatic->getNomUrl(0); + print $taskstatic->getNomUrl(0,'withproject'); //print "
"; //for ($k = 0 ; $k < $level ; $k++) print "   "; //print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0); @@ -613,14 +620,21 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t // Form to add new time print ''; - $s=''; - $s.=$form->select_date('',$lines[$i]->id,1,1,2,"addtime",1,0,1,$disabledtask); - print $s; + $tableCell=$form->select_date($preselectedday,$lines[$i]->id,1,1,2,"addtime",0,0,1,$disabledtask); + print $tableCell; print ''; - //$s.='   '; - $s=$form->select_duration($lines[$i]->id.'duration','',$disabledtask,'text',0,1); - //$s.=' '; - print $s; + + $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]; + $alreadyspent=''; + if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); + + $tableCell=''; + $tableCell.=''; + $tableCell.=' + '; + //$tableCell.='   '; + $tableCell.=$form->select_duration($lines[$i]->id.'duration','',$disabledtask,'text',0,1); + //$tableCell.=' '; + print $tableCell; print ''; print ''; @@ -633,7 +647,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t $inc++; $level++; - if ($lines[$i]->id) projectLinesPerDay($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask); + if ($lines[$i]->id) projectLinesPerDay($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday); $level--; } else @@ -776,18 +790,30 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ for ($idw = 0; $idw < 7; $idw++) { $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd'); + $tmparray=dol_getdate($tmpday); $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]; $alreadyspent=''; if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); $tableCell =''; $tableCell.=''; - $tableCell.='+'; - $tableCell.=''; + //$placeholder=' placeholder="00:00"'; + $placeholder=''; + //if (! $disabledtask) + //{ + $tableCell.='+'; + $tableCell.=''; + //} $tableCell.=''; print $tableCell; } + + print ''; + if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject")); + else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou")); + print ''; + print "\n"; } diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index ce4300e67c2..52ab660e21b 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -220,6 +220,7 @@ Next=Next Cards=Cards Card=Card Now=Now +HourStart=Start hour Date=Date DateAndHour=Date and hour DateStart=Date start diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 40b1c2e308d..e56ddf2ec4a 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -14,6 +14,7 @@ MyTasksDesc=This view is limited to projects or tasks you are a contact for (wha OnlyOpenedProject=Only opened projects are visible (projects with draft or closed status are not visible). TasksPublicDesc=This view presents all projects and tasks you are allowed to read. TasksDesc=This view presents all projects and tasks (your user permissions grant you permission to view everything). +AllTaskVisibleButEditIfYouAreAssigned=All tasks for such project are visible, but you can enter time only for task you are assigned on. ProjectsArea=Projects area NewProject=New project AddProject=Create project diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 9c55874a762..1df9359dfa5 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -48,11 +48,33 @@ $socid=0; if ($user->societe_id > 0) $socid=$user->societe_id; $result = restrictedArea($user, 'projet', $projectid); +$now=dol_now(); +$nowtmp=dol_getdate($now); +$nowday=$nowtmp['mday']; +$nowmonth=$nowtmp['mon']; +$nowyear=$nowtmp['year']; + +$year=GETPOST('reyear')?GETPOST('reyear'):(GETPOST("year","int")?GETPOST("year","int"):date("Y")); +$month=GETPOST('remonth')?GETPOST('remonth'):(GETPOST("month","int")?GETPOST("month","int"):date("m")); +$day=GETPOST('reday')?GETPOST('reday'):(GETPOST("day","int")?GETPOST("day","int"):date("d")); +$day = (int) $day; +$week=GETPOST("week","int")?GETPOST("week","int"):date("W"); + +$daytoparse = $now; +if ($year && $month && $day) $daytoparse=dol_mktime(0, 0, 0, $month, $day, $year); + /* * Actions */ +if (GETPOST('submitdateselect')) +{ + $daytoparse = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + + $action = ''; +} + if ($action == 'addtime' && $user->rights->projet->creer) { $task = new Task($db); @@ -133,6 +155,16 @@ $projectstatic=new Project($db); $project = new Project($db); $taskstatic = new Task($db); +$prev = dol_getdate($daytoparse - (24 * 3600)); +$prev_year = $prev['year']; +$prev_month = $prev['mon']; +$prev_day = $prev['mday']; + +$next = dol_getdate($daytoparse + (24 * 3600)); +$next_year = $next['year']; +$next_month = $next['mon']; +$next_day = $next['mday']; + $title=$langs->trans("TimeSpent"); if ($mine) $title=$langs->trans("MyTimeSpent"); @@ -160,7 +192,18 @@ llxHeader("",$title,""); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num); -print ''; +// Show navigation bar +$nav ="".img_previous($langs->trans("Previous"))."\n"; +$nav.=" ".dol_print_date(dol_mktime(0,0,0,$month,$day,$year),"day")." \n"; +$nav.="".img_next($langs->trans("Next"))."\n"; +$nav.="   (".$langs->trans("Today").")"; +$nav.='
'.$form->select_date(-1,'',0,0,2,"addtime",1,0,1).' '; +$nav.=' '; + +$picto='calendarweek'; + + +print 'id > 0 ? '?id='.$project->id : '').'">'; print ''; print ''; print ''; @@ -169,13 +212,15 @@ $head=project_timesheet_prepare_head($mode); dol_fiche_head($head, 'inputperday', '', 0, 'task'); // Show description of content -if ($mine) print $langs->trans("MyTasksDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'

'; +if ($mine) print $langs->trans("MyTasksDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'
'; else { - if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'

'; - else print $langs->trans("ProjectsPublicTaskDesc").($onlyopened?' '.$langs->trans("AlsoOnlyOpenedProject"):'').'

'; + if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'
'; + else print $langs->trans("ProjectsPublicTaskDesc").($onlyopened?' '.$langs->trans("AlsoOnlyOpenedProject"):'').'
'; } - +print $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'
'; +print '
'; +print "\n"; // Filter on user /* dol_fiche_head(''); @@ -197,6 +242,10 @@ else dol_fiche_end(); */ + +print '
'.$nav.'
'; + + print ''; print ''; print ''; @@ -207,7 +256,7 @@ print ''; print ''; if ($usertoprocess->id == $user->id) print ''; else print ''; -print ''; +print ''; print ''; print "\n"; @@ -217,7 +266,7 @@ $restricteditformytask=(empty($conf->global->PROJECT_TIME_ON_ALL_TASKS_MY_PROJEC if (count($tasksarray) > 0) { $j=0; - projectLinesPerDay($j, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask); + projectLinesPerDay($j, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $daytoparse); } else { @@ -234,6 +283,13 @@ print ''; print ''; +print ''; + + llxFooter(); $db->close(); diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index b7ab0a8bd71..77b65a19c6b 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -49,12 +49,15 @@ if ($user->societe_id > 0) $socid=$user->societe_id; $result = restrictedArea($user, 'projet', $projectid); $now=dol_now(); - -$year=GETPOST("year","int")?GETPOST("year","int"):date("Y"); -$month=GETPOST("month","int")?GETPOST("month","int"):date("m"); -$week=GETPOST("week","int")?GETPOST("week","int"):date("W"); -$day=GETPOST("day","int")?GETPOST("day","int"):date("d"); +$nowtmp=dol_getdate($now); +$nowday=$nowtmp['mday']; +$nowmonth=$nowtmp['mon']; +$nowyear=$nowtmp['year']; +$year=GETPOST('reyear')?GETPOST('reyear'):(GETPOST("year","int")?GETPOST("year","int"):date("Y")); +$month=GETPOST('remonth')?GETPOST('remonth'):(GETPOST("month","int")?GETPOST("month","int"):date("m")); +$day=GETPOST('reday')?GETPOST('reday'):(GETPOST("day","int")?GETPOST("day","int"):date("d")); $day = (int) $day; +$week=GETPOST("week","int")?GETPOST("week","int"):date("W"); $startdayarray=dol_get_first_day_week($day, $month, $year); @@ -83,6 +86,13 @@ $usertoprocess=$user; * Actions */ +if (GETPOST('submitdateselect')) +{ + $daytoparse = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + + $action = ''; +} + if ($action == 'addtime' && $user->rights->projet->creer) { $task = new Task($db); @@ -176,16 +186,15 @@ llxHeader("",$title,"",'','','',array('/core/js/timesheet.js')); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num); -$tmpday = $first_day; - // 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("Week")." ".$week; -$nav.=" \n"; +$nav.=" ".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("Week")." ".$week." \n"; $nav.="".img_next($langs->trans("Next"))."\n"; $nav.="   (".$langs->trans("Today").")"; -$picto='calendarweek'; +$nav.='
'.$form->select_date(-1,'',0,0,2,"addtime",1,0,1).' '; +$nav.=' '; +$picto='calendarweek'; print ''; print ''; @@ -199,12 +208,14 @@ $head=project_timesheet_prepare_head($mode); dol_fiche_head($head, 'inputperweek', '', 0, 'task'); // Show description of content -if ($mine) print $langs->trans("MyTasksDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'

'; +if ($mine) print $langs->trans("MyTasksDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'
'; else { - if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'

'; - else print $langs->trans("ProjectsPublicTaskDesc").($onlyopened?' '.$langs->trans("AlsoOnlyOpenedProject"):'').'

'; + if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'
'; + else print $langs->trans("ProjectsPublicTaskDesc").($onlyopened?' '.$langs->trans("AlsoOnlyOpenedProject"):'').'
'; } +print $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'
'; +print '
'; print "\n"; // Filter on user @@ -248,6 +259,7 @@ for($i=0;$i<7;$i++) { print ''; } +print ''; print "\n"; @@ -268,11 +280,12 @@ if (count($tasksarray) > 0) + '; } else { - print ''; + print ''; } print "
'.$langs->trans("Project").''.$langs->trans("ProgressDeclared").''.$langs->trans("TimeSpent").''.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.$langs->trans("DateAndHour").''.$langs->trans("HourStart").''.$langs->trans("Duration").'
'.dol_print_date($startday + ($i * 3600 * 24), '%a').'
'.dol_print_date($startday + ($i * 3600 * 24), 'day').'
 
 
 
'.$langs->trans("NoTasks").'
'.$langs->trans("NoTasks").'
"; @@ -287,6 +300,7 @@ print ''; print ''."\n\n"; + $modeinput='hours'; print '