diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 7b797b98ab0..3848960e5e9 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -170,6 +170,8 @@ class box_graph_invoices_permonth extends ModeleBoxes $mesg = $px2->isGraphKo(); if (! $mesg) { + $langs->load("bills"); + $px2->SetData($data2); unset($data2); $px2->SetPrecisionY(0); diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 31d9f811257..0931d2d05df 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -169,6 +169,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $mesg = $px2->isGraphKo(); if (! $mesg) { + $langs->load("bills"); + $px2->SetData($data2); unset($data2); $px2->SetPrecisionY(0); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0e6214560c4..e01529727e7 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1118,7 +1118,9 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e if (! is_object($outputlangs)) $outputlangs=$langs; if (! $format) $format='daytextshort'; $reduceformat=(! empty($conf->dol_optimize_smallscreen) && in_array($format,array('day','dayhour')))?1:0; - + $formatwithoutreduce = preg_replace('/reduceformat/','',$format); + if ($formatwithoutreduce != $format) { $format = $formatwithoutreduce; $reduceformat=1; } // so format 'dayreduceformat' is processed like day + // Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default. if ($format == 'day') $format=($outputlangs->trans("FormatDateShort")!="FormatDateShort"?$outputlangs->trans("FormatDateShort"):$conf->format_date_short); else if ($format == 'hour') $format=($outputlangs->trans("FormatHourShort")!="FormatHourShort"?$outputlangs->trans("FormatHourShort"):$conf->format_hour_short); diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index efbaa78557e..d354721332a 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -794,17 +794,19 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]; $alreadyspent=''; if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); + $alttitle=$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']); + $tableCell ='
| '; print ' | '; } - if (! empty($arrayfields['p.statut']['checked'])) + if (! empty($arrayfields['p.fk_statut']['checked'])) { print ''; print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('Draft'),'1'=>$langs->trans('Opened'),'2'=>$langs->trans('Closed')),$search_status); @@ -480,17 +513,17 @@ if ($resql) print ''."\n"; - - while ($i < $num) + $i = 0; + while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); $projectstatic->id = $obj->projectid; $projectstatic->user_author_id = $obj->fk_user_creat; $projectstatic->public = $obj->public; - - $userAccess = $projectstatic->restrictedProjectArea($user); - + $projectstatic->ref = $obj->ref; + + $userAccess = $projectstatic->restrictedProjectArea($user); // why this ? if ($userAccess >= 0) { $var=!$var; @@ -500,7 +533,6 @@ if ($resql) if (! empty($arrayfields['p.ref']['checked'])) { print ' | '; - $projectstatic->ref = $obj->ref; print $projectstatic->getNomUrl(1); print ' | '; } @@ -636,7 +668,7 @@ if ($resql) print ''; } // Status - if (! empty($arrayfields['p.statut']['checked'])) + if (! empty($arrayfields['p.fk_statut']['checked'])) { $projectstatic->statut = $obj->fk_statut; print ''.$projectstatic->getLibStatut(5).' | '; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index d23617192b3..e140ee2f672 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -28,60 +28,128 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $langs->load('projects'); $langs->load('users'); +$langs->load('companies'); $id=GETPOST('id','int'); $search_all=GETPOST('search_all'); $search_project=GETPOST('search_project'); -if (! isset($_GET['search_status']) && ! isset($_POST['search_status'])) $search_status=1; -else $search_status=GETPOST('search_status'); +if (! isset($_GET['search_projectstatus']) && ! isset($_POST['search_projectstatus'])) $search_projectstatus=1; +else $search_projectstatus=GETPOST('search_projectstatus'); +$search_project_ref=GETPOST('search_project_ref'); +$search_project_title=GETPOST('search_project_title'); $search_task_ref=GETPOST('search_task_ref'); $search_task_label=GETPOST('search_task_label'); +$search_task_description=GETPOST('search_task_description'); $search_project_user=GETPOST('search_project_user'); $search_task_user=GETPOST('search_task_user'); $mine = $_REQUEST['mode']=='mine' ? 1 : 0; -if ($mine) $search_task_user = $user->id; +if ($mine) { $search_task_user = $user->id; $mine = 0; } + +$sday = GETPOST('sday','int'); +$smonth = GETPOST('smonth','int'); +$syear = GETPOST('syear','int'); +$day = GETPOST('day','int'); +$month = GETPOST('month','int'); +$year = GETPOST('year','int'); + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$contextpage='tasklist'; + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array($contextpage)); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('project'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); // Security check $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; if (!$user->rights->projet->lire) accessforbidden(); -$sortfield = GETPOST("sortfield"); -$sortorder = GETPOST("sortorder"); -$page = GETPOST("page"); -$page = is_numeric($page) ? $page : 0; -$page = $page == -1 ? 0 : $page; - -// Purge criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers -{ - $search_all=""; - $search_project=""; - $search_status=""; - $search_task_ref=""; - $search_task_label=""; - $search_task_user=-1; - $search_project_user=-1; -} -if (empty($search_status) && $search_status == '') $search_status=1; +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; +if ($page == -1) { $page = 0; } +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortfield) $sortfield='p.ref'; +if (! $sortorder) $sortorder='DESC'; // List of fields to search into when doing a "search in all" $fieldstosearchall = array( 't.ref'=>"Ref", - 't.label'=>"Label", + 't.label'=>"Label", + 't.description'=>"Description", + 't.note_public'=>"NotePublic", ); +if (empty($user->socid)) $fieldstosearchall['t.note_private']="NotePrivate"; + +$arrayfields=array( + 'p.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>1), + 'p.title'=>array('label'=>$langs->trans("ProjectLabel"), 'checked'=>0), + 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>0), + 'p.fk_statut'=>array('label'=>$langs->trans("ProjectStatus"), 'checked'=>1), + 't.ref'=>array('label'=>$langs->trans("RefTask"), 'checked'=>1, 'position'=>80), + 't.label'=>array('label'=>$langs->trans("LabelTask"), 'checked'=>1, 'position'=>80), + 't.dateo'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>100), + 't.datee'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>101), + 't.planned_workload'=>array('label'=>$langs->trans("PlannedWorkload"), 'checked'=>1, 'position'=>102), + 't.duration_effective'=>array('label'=>$langs->trans("TimeSpent"), 'checked'=>1, 'position'=>103), + 't.progress_calculated'=>array('label'=>$langs->trans("ProgressCalculated"), 'checked'=>1, 'position'=>104), + 't.progress'=>array('label'=>$langs->trans("ProgressDeclared"), 'checked'=>1, 'position'=>105), + 't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), + //'t.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), +); +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); + } +} /* * Actions */ -// None +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + +// Purge criteria +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_all=""; + $search_project=""; + $search_projectstatus=-1; + $search_project_ref=""; + $search_project_title=""; + $search_task_ref=""; + $search_task_label=""; + $search_task_description=""; + $search_task_user=-1; + $search_project_user=-1; + $sday=''; + $smonth=''; + $syear=''; + $day=''; + $month=''; + $year=''; +} +if (empty($search_projectstatus) && $search_projectstatus == '') $search_projectstatus=1; + + /* @@ -89,6 +157,8 @@ $fieldstosearchall = array( */ $form=new Form($db); +$formother=new FormOther($db); +$socstatic=new Societe($db); $projectstatic = new Project($db); $taskstatic = new Task($db); $puser=new User($db); @@ -97,7 +167,7 @@ if ($search_project_user > 0) $puser->fetch($search_project_user); if ($search_task_user > 0) $tuser->fetch($search_task_user); $title=$langs->trans("Activities"); -if ($mine) $title=$langs->trans("MyActivities"); +if ($search_task_user == $user->id) $title=$langs->trans("MyActivities"); llxHeader("",$title,"Projet"); @@ -107,143 +177,546 @@ if ($id) $projectstatic->societe->fetch($projectstatic->societe->id); } -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project'); - -// Show description of content -if ($mine) print $langs->trans("MyTasksDesc").'