NEW Can read time spent of others (hierarchy only or all if granted)

This commit is contained in:
Laurent Destailleur 2017-06-02 12:27:46 +02:00
parent bebf2b33ea
commit c59d216cf5
13 changed files with 269 additions and 338 deletions

View File

@ -1,86 +0,0 @@
<?php
/* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/actions_setnotes.inc.php
* \brief Code for actions on setting notes of object page
*/
// $action must be defined
// $_FILES may be defined
// $nomessageinsetmoduleoptions can be set to 1
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
if ($action == 'setModuleOptions')
{
$db->begin();
// Process common param fields
foreach($_POST as $key => $val)
{
if (preg_match('/^param(\d*)$/', $key, $reg)) // Works for POST['param'], POST['param1'], POST['param2'], ...
{
$param=GETPOST("param".$reg[1],'alpha');
$value=GETPOST("value".$reg[1],'alpha');
if ($param)
{
$res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
}
}
// Process upload fields
if (GETPOST('upload','alpha') && GETPOST('keyforuploaddir','aZ09'))
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$keyforuploaddir=GETPOST('keyforuploaddir','aZ09');
$listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->$keyforuploaddir)));
foreach($listofdir as $key=>$tmpdir)
{
$tmpdir=trim($tmpdir);
$tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir);
if (! $tmpdir) {
unset($listofdir[$key]); continue;
}
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
else
{
$upload_dir=$tmpdir;
}
}
if ($upload_dir)
{
$result = dol_add_file_process($upload_dir, 0, 1, 'uploadfile', '');
if ($result <= 0) $error++;
}
}
if (! $error)
{
$db->commit();
if (empty($nomessageinsetmoduleoptions)) setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
$db->rollback();
if (empty($nomessageinsetmoduleoptions)) setEventMessages($langs->trans("SetupNotSaved"), null, 'errors');
}
}

View File

@ -1391,7 +1391,7 @@ class Form
* @deprecated * @deprecated
* @see select_dolusers() * @see select_dolusers()
*/ */
function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=0) function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude=null,$disabled=0,$include='',$enableonly='',$force_entity=0)
{ {
print $this->select_dolusers($selected,$htmlname,$show_empty,$exclude,$disabled,$include,$enableonly,$force_entity); print $this->select_dolusers($selected,$htmlname,$show_empty,$exclude,$disabled,$include,$enableonly,$force_entity);
} }
@ -1411,13 +1411,13 @@ class Form
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status * @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @param string $morefilter Add more filters into sql request * @param string $morefilter Add more filters into sql request
* @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list * @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list
* @param string $enableonlytext If option $enableonly is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty. * @param string $enableonlytext If option $enableonlytext is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty.
* @param string $morecss More css * @param string $morecss More css
* @param int $noactive Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on). * @param int $noactive Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on).
* @return string HTML select string * @return string HTML select string
* @see select_dolgroups * @see select_dolgroups
*/ */
function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='', $morecss='', $noactive=0) function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='', $morecss='', $noactive=0)
{ {
global $conf,$user,$langs; global $conf,$user,$langs;
@ -1613,7 +1613,7 @@ class Form
* @return string HTML select string * @return string HTML select string
* @see select_dolgroups * @see select_dolgroups
*/ */
function select_dolusers_forevent($action='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='') function select_dolusers_forevent($action='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='')
{ {
global $conf,$user,$langs; global $conf,$user,$langs;

View File

@ -693,16 +693,17 @@ class FormCompany
* @param string $source Source ('internal' or 'external') * @param string $source Source ('internal' or 'external')
* @param string $sortorder Sort criteria ('position', 'code', ...) * @param string $sortorder Sort criteria ('position', 'code', ...)
* @param int $showempty 1=Add en empty line * @param int $showempty 1=Add en empty line
* @param string $morecss Add more css to select component
* @return void * @return void
*/ */
function selectTypeContact($object, $selected, $htmlname = 'type', $source='internal', $sortorder='position', $showempty=0) function selectTypeContact($object, $selected, $htmlname = 'type', $source='internal', $sortorder='position', $showempty=0, $morecss='')
{ {
global $user, $langs; global $user, $langs;
if (is_object($object) && method_exists($object, 'liste_type_contact')) if (is_object($object) && method_exists($object, 'liste_type_contact'))
{ {
$lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1); $lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1);
print '<select class="flat valignmiddle" name="'.$htmlname.'" id="'.$htmlname.'">'; print '<select class="flat valignmiddle'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" id="'.$htmlname.'">';
if ($showempty) print '<option value="0"></option>'; if ($showempty) print '<option value="0"></option>';
foreach($lesTypes as $key=>$value) foreach($lesTypes as $key=>$value)
{ {

View File

@ -170,21 +170,19 @@ class FormProjets
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$minmax='maxwidth500'; $morecss='maxwidth500';
// Use select2 selector // Use select2 selector
$nodatarole='';
if (! empty($conf->use_javascript_ajax)) if (! empty($conf->use_javascript_ajax))
{ {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox($htmlid, array(), 0, $forcefocus); $comboenhancement = ajax_combobox($htmlid, array(), 0, $forcefocus);
$out.=$comboenhancement; $out.=$comboenhancement;
$nodatarole=($comboenhancement?' data-role="none"':''); $morecss='minwidth100 maxwidth300';
$minmax='minwidth100 maxwidth300';
} }
if (empty($option_only)) { if (empty($option_only)) {
$out.= '<select class="flat'.($minmax?' '.$minmax:'').'"'.($disabled?' disabled="disabled"':'').' id="'.$htmlid.'" name="'.$htmlname.'"'.$nodatarole.'>'; $out.= '<select class="flat'.($morecss?' '.$morecss:'').'"'.($disabled?' disabled="disabled"':'').' id="'.$htmlid.'" name="'.$htmlname.'">';
} }
if (!empty($show_empty)) { if (!empty($show_empty)) {
$out.= '<option value="0">&nbsp;</option>'; $out.= '<option value="0">&nbsp;</option>';
@ -302,13 +300,14 @@ class FormProjets
* @param string $htmlname Name of HTML select * @param string $htmlname Name of HTML select
* @param int $maxlength Maximum length of label * @param int $maxlength Maximum length of label
* @param int $option_only Return only html options lines without the select tag * @param int $option_only Return only html options lines without the select tag
* @param int $show_empty Add an empty line * @param string $show_empty Add an empty line ('1' or string to show for empty line)
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable) * @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
* @param int $forcefocus Force focus on field (works with javascript only) * @param int $forcefocus Force focus on field (works with javascript only)
* @param int $disabled Disabled * @param int $disabled Disabled
* @param string $morecss More css added to the select component
* @return int Nbr of project if OK, <0 if KO * @return int Nbr of project if OK, <0 if KO
*/ */
function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0) function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24, $option_only=0, $show_empty='1', $discard_closed=0, $forcefocus=0, $disabled=0, $morecss='maxwidth500')
{ {
global $user,$conf,$langs; global $user,$conf,$langs;
@ -339,28 +338,26 @@ class FormProjets
if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)"; if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
$sql.= " ORDER BY p.ref, t.ref ASC"; $sql.= " ORDER BY p.ref, t.ref ASC";
dol_syslog(__METHOD__, LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$minmax='maxwidth500';
// Use select2 selector // Use select2 selector
$nodatarole='';
if (! empty($conf->use_javascript_ajax)) if (! empty($conf->use_javascript_ajax))
{ {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus); $comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
$out.=$comboenhancement; $out.=$comboenhancement;
$nodatarole=($comboenhancement?' data-role="none"':''); $morecss='minwidth200 maxwidth500';
$minmax='minwidth200 maxwidth500';
} }
if (empty($option_only)) { if (empty($option_only)) {
$out.= '<select class="valignmiddle flat'.($minmax?' '.$minmax:'').'"'.($disabled?' disabled="disabled"':'').' id="'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>'; $out.= '<select class="valignmiddle flat'.($morecss?' '.$morecss:'').'"'.($disabled?' disabled="disabled"':'').' id="'.$htmlname.'" name="'.$htmlname.'">';
} }
if (!empty($show_empty)) { if (! empty($show_empty)) {
$out.= '<option value="0">&nbsp;</option>'; $out.= '<option value="0" class="optiongrey">';
if (! is_numeric($show_empty)) $out.=$show_empty;
else $out.='&nbsp;';
$out.= '</option>';
} }
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
@ -370,7 +367,7 @@ class FormProjets
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
// If we ask to filter on a company and user has no permission to see all companies and project is linked to another company, we hide project. // If we ask to filter on a company and user has no permission to see all companies and project is linked to another company, we hide project.
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && ! $user->rights->societe->lire) if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && empty($user->rights->societe->lire))
{ {
// Do nothing // Do nothing
} }
@ -382,7 +379,7 @@ class FormProjets
continue; continue;
} }
$labeltoshow=dol_trunc($obj->ref,18); $labeltoshow=dol_trunc($obj->ref,18); // Project ref
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')'; //if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')'; //else $labeltoshow.=' ('.$langs->trans("Private").')';
$labeltoshow.=' '.dol_trunc($obj->title,$maxlength); $labeltoshow.=' '.dol_trunc($obj->title,$maxlength);
@ -532,7 +529,6 @@ class FormProjets
$sql.= " ORDER BY ref DESC"; $sql.= " ORDER BY ref DESC";
dol_syslog(get_class($this).'::select_element', LOG_DEBUG); dol_syslog(get_class($this).'::select_element', LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -1,5 +1,5 @@
/* Copyright (C) 2014 delcroip <delcroip@gmail.com> /* Copyright (C) 2014 delcroip <delcroip@gmail.com>
* Laurent Destailleur 2015 <eldy@users.sourceforge.net> * Copyright (C) 2015-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -208,9 +208,10 @@ function task_prepare_head($object)
* Prepare array with list of tabs * Prepare array with list of tabs
* *
* @param string $mode Mode * @param string $mode Mode
* @param string $fuser Filter on user
* @return array Array of tabs to show * @return array Array of tabs to show
*/ */
function project_timesheet_prepare_head($mode) function project_timesheet_prepare_head($mode, $fuser=null)
{ {
global $langs, $conf, $user; global $langs, $conf, $user;
$h = 0; $h = 0;
@ -218,9 +219,13 @@ function project_timesheet_prepare_head($mode)
$h = 0; $h = 0;
$param='';
$param.=($mode?'&mode='.$mode:'');
if (is_object($fuser) && $fuser->id > 0 && $fuser->id != $user->id) $param.='&search_usertoprocessid='.$fuser->id;
if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERWEEK)) if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERWEEK))
{ {
$head[$h][0] = DOL_URL_ROOT."/projet/activity/perweek.php".($mode?'?mode='.$mode:''); $head[$h][0] = DOL_URL_ROOT."/projet/activity/perweek.php".($param?'?'.$param:'');
$head[$h][1] = $langs->trans("InputPerWeek"); $head[$h][1] = $langs->trans("InputPerWeek");
$head[$h][2] = 'inputperweek'; $head[$h][2] = 'inputperweek';
$h++; $h++;
@ -228,7 +233,7 @@ function project_timesheet_prepare_head($mode)
if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERTIME)) if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERTIME))
{ {
$head[$h][0] = DOL_URL_ROOT."/projet/activity/perday.php".($mode?'?mode='.$mode:''); $head[$h][0] = DOL_URL_ROOT."/projet/activity/perday.php".($param?'?'.$param:'');
$head[$h][1] = $langs->trans("InputPerDay"); $head[$h][1] = $langs->trans("InputPerDay");
$head[$h][2] = 'inputperday'; $head[$h][2] = 'inputperday';
$h++; $h++;
@ -621,7 +626,12 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
$taskstatic->id=$lines[$i]->id; $taskstatic->id=$lines[$i]->id;
print "<tr ".$bc[$var].">\n"; print '<tr class="oddeven">'."\n";
// User
print '<td class="nowrap">';
print $fuser->getNomUrl(1, 'withproject', 'time');
print '</td>';
// Ref // Ref
print '<td>'; print '<td>';
@ -707,7 +717,10 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
print '<td class="nowrap" align="center">'; print '<td class="nowrap" align="center">';
$tableCell=$form->select_date($preselectedday,$lines[$i]->id,1,1,2,"addtime",0,0,1,$disabledtask); $tableCell=$form->select_date($preselectedday,$lines[$i]->id,1,1,2,"addtime",0,0,1,$disabledtask);
print $tableCell; print $tableCell;
print '</td><td align="right">'; print '</td>';
// Duration
print '<td align="right">';
$dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]; $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id];
$alreadyspent=''; $alreadyspent='';
@ -723,13 +736,14 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject")); print '<textarea name="'.$lines[$i]->id.'note" rows="'.ROWS_2.'" id="'.$lines[$i]->id.'note"'.($disabledtask?' disabled="disabled"':'').'>';
else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou")); print '</textarea>';
print '</td>'; print '</td>';
// Warning
print '<td align="right">'; print '<td align="right">';
print '<textarea name="'.$lines[$i]->id.'note" rows="2" id="note">'; if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject"));
print '</textarea>'; else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $langs->transnoentitiesnoconv("AssignTaskToUser", '...')));
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
@ -818,7 +832,12 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
$workloadforid[$projectstatic->id]=1; $workloadforid[$projectstatic->id]=1;
} }
print "<tr ".$bc[$var].">\n"; print '<tr class="oddeven">'."\n";
// User
print '<td class="nowrap">';
print $fuser->getNomUrl(1, 'withproject', 'time');
print '</td>';
// Ref // Ref
print '<td class="nowrap">'; print '<td class="nowrap">';
@ -842,7 +861,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
print "</td>\n"; print "</td>\n";
// Project // Project
print '<td class="nowrap">'.$var; print '<td class="nowrap">';
$projectstatic->id=$lines[$i]->fk_project; $projectstatic->id=$lines[$i]->fk_project;
$projectstatic->ref=$lines[$i]->projectref; $projectstatic->ref=$lines[$i]->projectref;
$projectstatic->title=$lines[$i]->projectlabel; $projectstatic->title=$lines[$i]->projectlabel;
@ -935,9 +954,10 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
print $tableCell; print $tableCell;
} }
// Warning
print '<td align="right">'; print '<td align="right">';
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject")); if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject"));
else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou")); else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $langs->transnoentitiesnoconv("AssignTaskToUser", '...')));
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -614,7 +614,7 @@ Permission32=Create/modify products
Permission34=Delete products Permission34=Delete products
Permission36=See/manage hidden products Permission36=See/manage hidden products
Permission38=Export products Permission38=Export products
Permission41=Read projects and tasks (shared project and projects i'm contact for). Can also enter time consumed on assigned tasks (timesheet) Permission41=Read projects and tasks (shared project and projects i'm contact for). Can also enter time consumed, for me or my hierarchy, on assigned tasks (Timesheet)
Permission42=Create/modify projects (shared project and projects i'm contact for). Can also create tasks and assign users to project and tasks Permission42=Create/modify projects (shared project and projects i'm contact for). Can also create tasks and assign users to project and tasks
Permission44=Delete projects (shared project and projects i'm contact for) Permission44=Delete projects (shared project and projects i'm contact for)
Permission45=Export projects Permission45=Export projects

View File

@ -53,7 +53,7 @@ TaskTimeNote=Note
TaskTimeDate=Date TaskTimeDate=Date
TasksOnOpenedProject=Tasks on open projects TasksOnOpenedProject=Tasks on open projects
WorkloadNotDefined=Workload not defined WorkloadNotDefined=Workload not defined
NewTimeSpent=New time spent NewTimeSpent=Time spent
MyTimeSpent=My time spent MyTimeSpent=My time spent
Tasks=Tasks Tasks=Tasks
Task=Task Task=Task
@ -107,6 +107,7 @@ ConfirmReOpenAProject=Are you sure you want to re-open this project?
ProjectContact=Project contacts ProjectContact=Project contacts
ActionsOnProject=Events on project ActionsOnProject=Events on project
YouAreNotContactOfProject=You are not a contact of this private project YouAreNotContactOfProject=You are not a contact of this private project
UserIsNotContactOfProject=User is not a contact of this private project
DeleteATimeSpent=Delete time spent DeleteATimeSpent=Delete time spent
ConfirmDeleteATimeSpent=Are you sure you want to delete this time spent? ConfirmDeleteATimeSpent=Are you sure you want to delete this time spent?
DoNotShowMyTasksOnly=See also tasks not assigned to me DoNotShowMyTasksOnly=See also tasks not assigned to me
@ -115,7 +116,7 @@ TaskRessourceLinks=Resources
ProjectsDedicatedToThisThirdParty=Projects dedicated to this third party ProjectsDedicatedToThisThirdParty=Projects dedicated to this third party
NoTasks=No tasks for this project NoTasks=No tasks for this project
LinkedToAnotherCompany=Linked to other third party LinkedToAnotherCompany=Linked to other third party
TaskIsNotAffectedToYou=Task not assigned to you TaskIsNotAssignedToUser=Task not assigned to user. Use button '<strong>%s</strong>' to assign task now.
ErrorTimeSpentIsEmpty=Time spent is empty ErrorTimeSpentIsEmpty=Time spent is empty
ThisWillAlsoRemoveTasks=This action will also delete all tasks of project (<b>%s</b> tasks at the moment) and all inputs of time spent. ThisWillAlsoRemoveTasks=This action will also delete all tasks of project (<b>%s</b> tasks at the moment) and all inputs of time spent.
IfNeedToUseOhterObjectKeepEmpty=If some objects (invoice, order, ...), belonging to another third party, must be linked to the project to create, keep this empty to have the project being multi third parties. IfNeedToUseOhterObjectKeepEmpty=If some objects (invoice, order, ...), belonging to another third party, must be linked to the project to create, keep this empty to have the project being multi third parties.
@ -166,13 +167,15 @@ FirstAddRessourceToAllocateTime=Assign a user resource to task to allocate time
InputPerDay=Input per day InputPerDay=Input per day
InputPerWeek=Input per week InputPerWeek=Input per week
InputPerAction=Input per action InputPerAction=Input per action
TimeAlreadyRecorded=Time spent already recorded for this task/day and user %s TimeAlreadyRecorded=This is time spent already recorded for this task/day and user %s
ProjectsWithThisUserAsContact=Projects with this user as contact ProjectsWithThisUserAsContact=Projects with this user as contact
TasksWithThisUserAsContact=Tasks assigned to this user TasksWithThisUserAsContact=Tasks assigned to this user
ResourceNotAssignedToProject=Not assigned to project ResourceNotAssignedToProject=Not assigned to project
ResourceNotAssignedToTheTask=Not assigned to the task ResourceNotAssignedToTheTask=Not assigned to the task
TasksAssignedTo=Tasks assigned to TasksAssignedTo=Tasks assigned to
AssignTaskToMe=Assign task to me AssignTaskToMe=Assign task to me
AssignTaskToUser=Assign task to %s
SelectTaskToAssign=Select task to assign...
AssignTask=Assign AssignTask=Assign
ProjectOverview=Overview ProjectOverview=Overview
ManageTasks=Use projects to follow tasks and time ManageTasks=Use projects to follow tasks and time

View File

@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$langs->load('projects'); $langs->load('projects');
$langs->load('users');
$action=GETPOST('action','aZ09'); $action=GETPOST('action','aZ09');
$mode=GETPOST("mode"); $mode=GETPOST("mode");
@ -62,6 +63,8 @@ $month=GETPOST('remonth')?GETPOST('remonth'):(GETPOST("month","int")?GETPOST("mo
$day=GETPOST('reday')?GETPOST('reday'):(GETPOST("day","int")?GETPOST("day","int"):date("d")); $day=GETPOST('reday')?GETPOST('reday'):(GETPOST("day","int")?GETPOST("day","int"):date("d"));
$day = (int) $day; $day = (int) $day;
$week=GETPOST("week","int")?GETPOST("week","int"):date("W"); $week=GETPOST("week","int")?GETPOST("week","int"):date("W");
$search_usertoprocessid=GETPOST('search_usertoprocessid', 'int');
$search_task_ref=GETPOST('search_task_ref', 'alpha'); $search_task_ref=GETPOST('search_task_ref', 'alpha');
$search_task_label=GETPOST('search_task_label', 'alpha'); $search_task_label=GETPOST('search_task_label', 'alpha');
$search_project_ref=GETPOST('search_project_ref', 'alpha'); $search_project_ref=GETPOST('search_project_ref', 'alpha');
@ -75,6 +78,17 @@ $daytoparse = $now;
if ($yearofday && $monthofday && $dayofday) $daytoparse=dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday); // xxxofday is value of day after submit action 'addtime' if ($yearofday && $monthofday && $dayofday) $daytoparse=dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday); // xxxofday is value of day after submit action 'addtime'
else if ($year && $month && $day) $daytoparse=dol_mktime(0, 0, 0, $month, $day, $year); // this are value submited after submit of action 'submitdateselect' else if ($year && $month && $day) $daytoparse=dol_mktime(0, 0, 0, $month, $day, $year); // this are value submited after submit of action 'submitdateselect'
if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id)
{
$usertoprocess=$user;
}
else
{
$usertoprocess=new User($db);
$usertoprocess->fetch($search_usertoprocessid);
}
$search_usertoprocessid=$usertoprocess->id;
$object=new Task($db); $object=new Task($db);
@ -83,9 +97,10 @@ $object=new Task($db);
*/ */
// Purge criteria // Purge criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
{ {
$action = ''; $action = '';
$search_usertoprocessid = '';
$search_task_ref = ''; $search_task_ref = '';
$search_task_label = ''; $search_task_label = '';
$search_project_ref = ''; $search_project_ref = '';
@ -125,7 +140,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
} }
if (! $error) if (! $error)
{ {
$idfortaskuser=$user->id; $idfortaskuser=$usertoprocess->id;
$result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal'); $result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal');
if ($result >= 0 || $result == -2) // Contact add ok or already contact of task if ($result >= 0 || $result == -2) // Contact add ok or already contact of task
@ -175,6 +190,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
if (! $error) if (! $error)
{ {
setEventMessages("TaskAssignedToEnterTime", null); setEventMessages("TaskAssignedToEnterTime", null);
$taskid=0;
} }
$action=''; $action='';
@ -247,7 +263,7 @@ if ($action == 'addtime' && $user->rights->projet->lire)
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
// Redirect to avoid submit twice on back // Redirect to avoid submit twice on back
header('Location: '.$_SERVER["PHP_SELF"].($projectid?'?id='.$projectid:'?').($mode?'&mode='.$mode:'').'&year='.$yearofday.'&month='.$monthofday.'&day='.$dayofday); header('Location: '.$_SERVER["PHP_SELF"].'?'.($projectid?'id='.$projectid:'').($search_usertoprocessid?'&search_usertoprocessid='.$search_usertoprocessid:'').($mode?'&mode='.$mode:'').'&year='.$yearofday.'&month='.$monthofday.'&day='.$dayofday);
exit; exit;
} }
} }
@ -286,8 +302,6 @@ $next_day = $next['mday'];
$title=$langs->trans("TimeSpent"); $title=$langs->trans("TimeSpent");
if ($mine) $title=$langs->trans("MyTimeSpent"); if ($mine) $title=$langs->trans("MyTimeSpent");
$usertoprocess = $user;
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess,0,1); // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project $projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess,0,1); // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project
if ($id) if ($id)
@ -314,8 +328,9 @@ llxHeader("",$title,"");
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project'); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project');
$param=''; $param='';
$param.=($mode?'&amp;mode='.$mode:''); $param.=($mode?'&mode='.$mode:'');
$param.=($search_project_ref?'&amp;search_project_ref='.$search_project_ref:''); $param.=($search_project_ref?'&search_project_ref='.$search_project_ref:'');
$param.=($search_userassignedid > 0?'&search_userassignedid='.$search_usertoprocessid:'');
// Show navigation bar // Show navigation bar
$nav ='<a class="inline-block valignmiddle" href="?year='.$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param.'">'.img_previous($langs->trans("Previous"))."</a>\n"; $nav ='<a class="inline-block valignmiddle" href="?year='.$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param.'">'.img_previous($langs->trans("Previous"))."</a>\n";
@ -337,7 +352,7 @@ print '<input type="hidden" name="addtimeyear" value="'.$tmp['year'].'">';
print '<input type="hidden" name="addtimemonth" value="'.$tmp['mon'].'">'; print '<input type="hidden" name="addtimemonth" value="'.$tmp['mon'].'">';
print '<input type="hidden" name="addtimeday" value="'.$tmp['mday'].'">'; print '<input type="hidden" name="addtimeday" value="'.$tmp['mday'].'">';
$head=project_timesheet_prepare_head($mode); $head=project_timesheet_prepare_head($mode, $usertoprocess);
dol_fiche_head($head, 'inputperday', '', -1, 'task'); dol_fiche_head($head, 'inputperday', '', -1, 'task');
// Show description of content // Show description of content
@ -360,45 +375,17 @@ print '</div>';
dol_fiche_end(); dol_fiche_end();
print '<div class="floatright right'.($conf->dol_optimize_smallscreen?' centpercent':'').'">'.$nav.'</div>'; // We move this before the assign to components so, the default submit button is not the assign to.
// Filter on user
/* dol_fiche_head('');
print '<table class="border" width="100%"><tr><td width="25%">'.$langs->trans("User").'</td>';
print '<td>';
if ($mine) print $user->getLoginUrl(1);
print '</td>';
print '</tr></table>';
dol_fiche_end();
*/
// Filter on user
/* dol_fiche_head('');
print '<table class="border" width="100%"><tr><td width="25%">'.$langs->trans("User").'</td>';
print '<td>';
if ($mine) print $user->getLoginUrl(1);
print '</td>';
print '</tr></table>';
dol_fiche_end();
*/
// Add a new project/task
//print '<br>';
//print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
//print '<input type="hidden" name="action" value="assigntask">';
//print '<input type="hidden" name="mode" value="'.$mode.'">';
//print '<input type="hidden" name="year" value="'.$year.'">';
//print '<input type="hidden" name="month" value="'.$month.'">';
//print '<input type="hidden" name="day" value="'.$day.'">';
print '<div class="floatright right">'.$nav.'</div>'; // We move this before the assign to components so, the default submit button is not the assign to.
print '<div class="float valignmiddle">'; print '<div class="float valignmiddle">';
print $langs->trans("AssignTaskToMe").'<br>'; $titleassigntask = $langs->trans("AssignTaskToMe");
if ($usertoprocess->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", $usertoprocess->getFullName($langs));
print '<div class="taskiddiv inline-block">';
$formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1); $formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1);
print $formcompany->selectTypeContact($object, '', 'type','internal','rowid', 0); print '</div>';
print '<input type="submit" class="button valignmiddle" name="assigntask" value="'.$langs->trans("AssignTask").'">'; print ' ';
//print '</form>'; print $formcompany->selectTypeContact($object, '', 'type','internal','rowid', 0, 'maxwidth200');
print '<input type="submit" class="button valignmiddle" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">';
print '</div>'; print '</div>';
print '<div class="clearboth" style="padding-bottom: 8px;"></div>'; print '<div class="clearboth" style="padding-bottom: 8px;"></div>';
@ -408,6 +395,11 @@ print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" id="tablelines3">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" id="tablelines3">'."\n";
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
print '<td class="liste_titre">';
$usersettoshow='hierarchyme';
if ($user->rights->projet->all->lire) $usersettoshow='';
print $form->select_dolusers($usertoprocess->id, 'search_usertoprocessid', 0, null, 0, $usersettoshow, 0, 0, 0, 1, '', 0, '', 'maxwidth150');
print '</td>';
print '<td class="liste_titre"><input type="text" size="4" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'"></td>'; print '<td class="liste_titre"><input type="text" size="4" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'"></td>';
print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>'; print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>';
print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>'; print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
@ -427,6 +419,7 @@ print '</td>';
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("User").'</td>';
print '<td>'.$langs->trans("RefTask").'</td>'; print '<td>'.$langs->trans("RefTask").'</td>';
print '<td>'.$langs->trans("LabelTask").'</td>'; print '<td>'.$langs->trans("LabelTask").'</td>';
print '<td>'.$langs->trans("ProjectRef").'</td>'; print '<td>'.$langs->trans("ProjectRef").'</td>';
@ -436,12 +429,15 @@ if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY))
} }
print '<td align="right" class="maxwidth100">'.$langs->trans("PlannedWorkload").'</td>'; print '<td align="right" class="maxwidth100">'.$langs->trans("PlannedWorkload").'</td>';
print '<td align="right" class="maxwidth100">'.$langs->trans("ProgressDeclared").'</td>'; print '<td align="right" class="maxwidth100">'.$langs->trans("ProgressDeclared").'</td>';
print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpent").'</td>'; /*print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpent").'</td>';
if ($usertoprocess->id == $user->id) print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpentByYou").'</td>'; if ($usertoprocess->id == $user->id) print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpentByYou").'</td>';
else print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpentByUser").'</td>'; else print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpentByUser").'</td>';*/
print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpent").'<br>('.$langs->trans("Everybody").')</td>';
print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpent").'</td>';
print '<td align="center">'.$langs->trans("HourStart").'</td>'; print '<td align="center">'.$langs->trans("HourStart").'</td>';
print '<td align="center" colspan="2">'.$langs->trans("Duration").'</td>'; print '<td align="center">'.$langs->trans("Duration").'</td>';
print '<td align="right">'.$langs->trans("Note").'</td>'; print '<td align="right">'.$langs->trans("Note").'</td>';
print '<td align="center"></td>';
print "</tr>\n"; print "</tr>\n";
@ -455,7 +451,7 @@ if (count($tasksarray) > 0)
} }
else else
{ {
print '<tr><td colspan="10">'.$langs->trans("NoTasks").'</td></tr>'; print '<tr><td colspan="14">'.$langs->trans("NoTasks").'</td></tr>';
} }
print "</table>"; print "</table>";
print '</div>'; print '</div>';

View File

@ -58,11 +58,14 @@ $nowtmp=dol_getdate($now);
$nowday=$nowtmp['mday']; $nowday=$nowtmp['mday'];
$nowmonth=$nowtmp['mon']; $nowmonth=$nowtmp['mon'];
$nowyear=$nowtmp['year']; $nowyear=$nowtmp['year'];
$year=GETPOST('reyear')?GETPOST('reyear','int'):(GETPOST("year")?GETPOST("year","int"):date("Y")); $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")); $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=GETPOST('reday')?GETPOST('reday','int'):(GETPOST("day")?GETPOST("day","int"):date("d"));
$day = (int) $day; $day = (int) $day;
$week=GETPOST("week","int")?GETPOST("week","int"):date("W"); $week=GETPOST("week","int")?GETPOST("week","int"):date("W");
$search_usertoprocessid=GETPOST('search_usertoprocessid', 'int');
$search_task_ref=GETPOST('search_task_ref', 'alpha'); $search_task_ref=GETPOST('search_task_ref', 'alpha');
$search_task_label=GETPOST('search_task_label', 'alpha'); $search_task_label=GETPOST('search_task_label', 'alpha');
$search_project_ref=GETPOST('search_project_ref', 'alpha'); $search_project_ref=GETPOST('search_project_ref', 'alpha');
@ -88,7 +91,16 @@ $next_day = $next['day'];
$firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year); $firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd'); $lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd');
$usertoprocess=$user; if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id)
{
$usertoprocess=$user;
}
else
{
$usertoprocess=new User($db);
$usertoprocess->fetch($search_usertoprocessid);
}
$search_usertoprocessid=$usertoprocess->id;
$object=new Task($db); $object=new Task($db);
@ -98,9 +110,10 @@ $object=new Task($db);
*/ */
// Purge criteria // Purge criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
{ {
$action = ''; $action = '';
$search_usertoprocessid = '';
$search_task_ref = ''; $search_task_ref = '';
$search_task_label = ''; $search_task_label = '';
$search_project_ref = ''; $search_project_ref = '';
@ -140,10 +153,10 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
if (! $error) if (! $error)
{ {
$idfortaskuser=$user->id; $idfortaskuser=$usertoprocess->id;
$result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal'); $result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal');
if (! $result || $result == -2) // Contact add ok or already contact of task if ($result >= 0 || $result == -2) // Contact add ok or already contact of task
{ {
// Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project) // Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project)
$sql='SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact'; $sql='SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact';
@ -190,6 +203,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
if (! $error) if (! $error)
{ {
setEventMessages("TaskAssignedToEnterTime", null); setEventMessages("TaskAssignedToEnterTime", null);
$taskid=0;
} }
$action=''; $action='';
@ -262,7 +276,7 @@ if ($action == 'addtime' && $user->rights->projet->lire)
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
// Redirect to avoid submit twice on back // Redirect to avoid submit twice on back
header('Location: '.$_SERVER["PHP_SELF"].($projectid?'?id='.$projectid:'?').($mode?'&mode='.$mode:'').($day?'&day='.$day:'').($month?'&month='.$month:'').($year?'&year='.$year:'')); header('Location: '.$_SERVER["PHP_SELF"].'?'.($projectid?'id='.$projectid:'').($search_usertoprocessid?'&search_usertoprocessid='.$search_usertoprocessid:'').($mode?'&mode='.$mode:'').($day?'&day='.$day:'').($month?'&month='.$month:'').($year?'&year='.$year:''));
exit; exit;
} }
} }
@ -312,14 +326,15 @@ llxHeader("",$title,"",'','','',array('/core/js/timesheet.js'));
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project'); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project');
$param=''; $param='';
$param.=($mode?'&amp;mode='.$mode:''); $param.=($mode?'&mode='.$mode:'');
$param.=($search_project_ref?'&amp;search_project_ref='.$search_project_ref:''); $param.=($search_project_ref?'&search_project_ref='.$search_project_ref:'');
$param.=($search_usertoprocessid > 0?'&search_usertoprocessid='.$search_usertoprocessid:'');
// Show navigation bar // Show navigation bar
$nav ='<a class="inline-block valignmiddle" href="?year='.$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param.'">'.img_previous($langs->trans("Previous"))."</a>\n"; $nav ='<a class="inline-block valignmiddle" href="?year='.$prev_year."&month=".$prev_month."&day=".$prev_day.$param.'">'.img_previous($langs->trans("Previous"))."</a>\n";
$nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("WeekShort")." ".$week." </span>\n"; $nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("WeekShort")." ".$week." </span>\n";
$nav.='<a class="inline-block valignmiddle" href="?year='.$next_year."&amp;month=".$next_month."&amp;day=".$next_day.$param.'">'.img_next($langs->trans("Next"))."</a>\n"; $nav.='<a class="inline-block valignmiddle" href="?year='.$next_year."&month=".$next_month."&day=".$next_day.$param.'">'.img_next($langs->trans("Next"))."</a>\n";
$nav.=" &nbsp; (<a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param."\">".$langs->trans("Today")."</a>)"; $nav.=" &nbsp; (<a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
$nav.='<br>'.$form->select_date(-1,'',0,0,2,"addtime",1,0,1).' '; $nav.='<br>'.$form->select_date(-1,'',0,0,2,"addtime",1,0,1).' ';
$nav.=' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">'; $nav.=' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
@ -333,7 +348,7 @@ print '<input type="hidden" name="day" value="'.$day.'">';
print '<input type="hidden" name="month" value="'.$month.'">'; print '<input type="hidden" name="month" value="'.$month.'">';
print '<input type="hidden" name="year" value="'.$year.'">'; print '<input type="hidden" name="year" value="'.$year.'">';
$head=project_timesheet_prepare_head($mode); $head=project_timesheet_prepare_head($mode, $usertoprocess);
dol_fiche_head($head, 'inputperweek', '', -1, 'task'); dol_fiche_head($head, 'inputperweek', '', -1, 'task');
// Show description of content // Show description of content
@ -356,44 +371,17 @@ print '</div>';
dol_fiche_end(); dol_fiche_end();
// Filter on user print '<div class="floatright right'.($conf->dol_optimize_smallscreen?' centpercent':'').'">'.$nav.'</div>'; // We move this before the assign to components so, the default submit button is not the assign to.
/* dol_fiche_head('');
print '<table class="border" width="100%"><tr><td width="25%">'.$langs->trans("User").'</td>';
print '<td>';
if ($mine) print $user->getLoginUrl(1);
print '</td>';
print '</tr></table>';
dol_fiche_end();
*/
// Filter on user
/* dol_fiche_head('');
print '<table class="border" width="100%"><tr><td width="25%">'.$langs->trans("User").'</td>';
print '<td>';
if ($mine) print $user->getLoginUrl(1);
print '</td>';
print '</tr></table>';
dol_fiche_end();
*/
// Add a new project/task
//print '<br>';
//print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
//print '<input type="hidden" name="action" value="assigntask">';
//print '<input type="hidden" name="mode" value="'.$mode.'">';
//print '<input type="hidden" name="year" value="'.$year.'">';
//print '<input type="hidden" name="month" value="'.$month.'">';
//print '<input type="hidden" name="day" value="'.$day.'">';
print '<div class="floatright right">'.$nav.'</div>'; // We move this before the assign to components so, the default submit button is not the assign to.
print '<div class="float valignmiddle">'; print '<div class="float valignmiddle">';
print $langs->trans("AssignTaskToMe").'<br>'; $titleassigntask = $langs->trans("AssignTaskToMe");
if ($usertoprocess->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", $usertoprocess->getFullName($langs));
print '<div class="taskiddiv inline-block">';
$formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1); $formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1);
print $formcompany->selectTypeContact($object, '', 'type','internal','rowid', 0); print '</div>';
print '<input type="submit" class="button valignmiddle" name="assigntask" value="'.$langs->trans("AssignTask").'">'; print ' ';
//print '</form>'; print $formcompany->selectTypeContact($object, '', 'type','internal','rowid', 0, 'maxwidth200');
print '<input type="submit" class="button valignmiddle" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">';
print '</div>'; print '</div>';
print '<div class="clearboth" style="padding-bottom: 8px;"></div>'; print '<div class="clearboth" style="padding-bottom: 8px;"></div>';
@ -403,6 +391,11 @@ print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" id="tablelines3">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" id="tablelines3">'."\n";
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
print '<td class="liste_titre">';
$usersettoshow='hierarchyme';
if ($user->rights->projet->all->lire) $usersettoshow='';
print $form->select_dolusers($usertoprocess->id, 'search_usertoprocessid', 0, null, 0, $usersettoshow, 0, 0, 0, 1, '', 0, '', 'maxwidth150');
print '</td>';
print '<td class="liste_titre"><input type="text" size="4" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'"></td>'; print '<td class="liste_titre"><input type="text" size="4" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'"></td>';
print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>'; print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>';
print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>'; print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
@ -423,6 +416,7 @@ print '</td>';
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("User").'</td>';
print '<td>'.$langs->trans("RefTask").'</td>'; print '<td>'.$langs->trans("RefTask").'</td>';
print '<td>'.$langs->trans("LabelTask").'</td>'; print '<td>'.$langs->trans("LabelTask").'</td>';
print '<td>'.$langs->trans("ProjectRef").'</td>'; print '<td>'.$langs->trans("ProjectRef").'</td>';
@ -432,9 +426,11 @@ if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY))
} }
print '<td align="right" class="maxwidth75">'.$langs->trans("PlannedWorkload").'</td>'; print '<td align="right" class="maxwidth75">'.$langs->trans("PlannedWorkload").'</td>';
print '<td align="right" class="maxwidth75">'.$langs->trans("ProgressDeclared").'</td>'; print '<td align="right" class="maxwidth75">'.$langs->trans("ProgressDeclared").'</td>';
/*print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").'</td>';
if ($usertoprocess->id == $user->id) print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpentByYou").'</td>';
else print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpentByUser").'</td>';*/
print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").'<br>('.$langs->trans("Everybody").')</td>';
print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").'</td>'; print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").'</td>';
if ($usertoprocess->id == $user->id) print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpentByYou").'</td>';
else print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpentByUser").'</td>';
$startday=dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray['first_day'], $startdayarray['first_year']); $startday=dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray['first_day'], $startdayarray['first_year']);
@ -457,11 +453,11 @@ if (count($tasksarray) > 0)
$level=0; $level=0;
projectLinesPerWeek($j, $firstdaytoshow, $usertoprocess, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask); projectLinesPerWeek($j, $firstdaytoshow, $usertoprocess, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask);
$colspan=7; $colspan=8;
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) $colspan++; if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) $colspan++;
print '<tr class="liste_total"> print '<tr class="liste_total">
<td class="liste_total" colspan="'.$colspan.'" align="right">'.$langs->trans("Total").'</td> <td class="liste_total" colspan="'.$colspan.'">'.$langs->trans("Total").'</td>
<td class="liste_total hide0" align="center"><div id="totalDay[0]">&nbsp;</div></td> <td class="liste_total hide0" align="center"><div id="totalDay[0]">&nbsp;</div></td>
<td class="liste_total hide1" align="center"><div id="totalDay[1]">&nbsp;</div></td> <td class="liste_total hide1" align="center"><div id="totalDay[1]">&nbsp;</div></td>
<td class="liste_total hide2" align="center"><div id="totalDay[2]">&nbsp;</div></td> <td class="liste_total hide2" align="center"><div id="totalDay[2]">&nbsp;</div></td>
@ -474,7 +470,7 @@ if (count($tasksarray) > 0)
} }
else else
{ {
print '<tr><td colspan="11">'.$langs->trans("NoTasks").'</td></tr>'; print '<tr><td colspan="16">'.$langs->trans("NoTasks").'</td></tr>';
} }
print "</table>"; print "</table>";
print '</div>'; print '</div>';

View File

@ -711,10 +711,11 @@ elseif ($object->id > 0)
print '<input type="hidden" name="comefromclone" value="'.$comefromclone.'">'; print '<input type="hidden" name="comefromclone" value="'.$comefromclone.'">';
$head=project_prepare_head($object); $head=project_prepare_head($object);
dol_fiche_head($head, 'project', $langs->trans("Project"), -1, ($object->public?'projectpub':'project'));
if ($action == 'edit' && $userWrite > 0) if ($action == 'edit' && $userWrite > 0)
{ {
dol_fiche_head($head, 'project', $langs->trans("Project"), 0, ($object->public?'projectpub':'project'));
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
@ -835,6 +836,8 @@ elseif ($object->id > 0)
} }
else else
{ {
dol_fiche_head($head, 'project', $langs->trans("Project"), -1, ($object->public?'projectpub':'project'));
// Project card // Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
@ -843,9 +846,10 @@ elseif ($object->id > 0)
// Title // Title
$morehtmlref.=$object->title; $morehtmlref.=$object->title;
// Thirdparty // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ';
if ($object->thirdparty->id > 0) if ($object->thirdparty->id > 0)
{ {
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project'); $morehtmlref .= $object->thirdparty->getNomUrl(1, 'project');
} }
$morehtmlref.='</div>'; $morehtmlref.='</div>';

View File

@ -340,9 +340,9 @@ input.buttongen {
vertical-align: middle; vertical-align: middle;
} }
span.timesheetalreadyrecorded input { span.timesheetalreadyrecorded input {
/*font-size: smaller;*/
border: none; border: none;
/*background: transparent;*/ border-bottom: solid 1px rgba(0,0,0,0.4);
margin-right: 1px !important;
} }
select.flat, form.flat select { select.flat, form.flat select {
@ -363,8 +363,10 @@ select.flat, form.flat select {
.opacitytransp { .opacitytransp {
opacity: 0; opacity: 0;
} }
select:invalid { color: gray; } select:invalid {
input:disabled { color: gray;
}
input:disabled {
background:#ddd; background:#ddd;
} }
@ -988,7 +990,7 @@ div.fiche {
div.fiche { div.fiche {
margin-<?php print $left; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?6:($dol_hide_leftmenu?'6':'26')); ?>px; margin-<?php print $left; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?6:($dol_hide_leftmenu?'6':'26')); ?>px;
margin-<?php print $right; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?8:(empty($conf->dol_optimize_smallscreen)?'16':'6')); ?>px; margin-<?php print $right; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?8:(empty($conf->dol_optimize_smallscreen)?'16':'12')); ?>px;
<?php if (! empty($conf->dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'."\n"; ?> <?php if (! empty($conf->dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'."\n"; ?>
<?php if (! empty($conf->dol_hide_leftmenu)) print 'margin-bottom: 12px;'."\n"; ?> <?php if (! empty($conf->dol_hide_leftmenu)) print 'margin-bottom: 12px;'."\n"; ?>
} }
@ -2683,7 +2685,7 @@ input.liste_titre {
} }
.noborder tr.liste_total, .noborder tr.liste_total td, tr.liste_total, form.liste_total { .noborder tr.liste_total, .noborder tr.liste_total td, tr.liste_total, form.liste_total {
/* background: #F0F0F0; */ height: 32px;
} }
.noborder tr.liste_total td, tr.liste_total td, form.liste_total div { .noborder tr.liste_total td, tr.liste_total td, form.liste_total div {
color: #552266; color: #552266;

View File

@ -337,9 +337,9 @@ input.buttongen {
vertical-align: middle; vertical-align: middle;
} }
span.timesheetalreadyrecorded input { span.timesheetalreadyrecorded input {
/*font-size: smaller;*/
border: none; border: none;
/*background: transparent;*/ border-bottom: solid 1px rgba(0,0,0,0.1);
margin-right: 1px !important;
} }
select.flat, form.flat select { select.flat, form.flat select {
@ -1027,7 +1027,7 @@ div.fiche {
div.fiche { div.fiche {
margin-<?php print $left; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?6:($dol_hide_leftmenu?'4':'20')); ?>px; margin-<?php print $left; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?6:($dol_hide_leftmenu?'4':'20')); ?>px;
margin-<?php print $right; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?8:(empty($conf->dol_optimize_smallscreen)?'16':'4')); ?>px; margin-<?php print $right; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?8:(empty($conf->dol_optimize_smallscreen)?'16':'12')); ?>px;
<?php if (! empty($conf->dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'; ?> <?php if (! empty($conf->dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'; ?>
margin-bottom: 15px; margin-bottom: 15px;
} }
@ -2769,7 +2769,7 @@ input.liste_titre {
} }
.noborder tr.liste_total, .noborder tr.liste_total td, tr.liste_total, form.liste_total { .noborder tr.liste_total, .noborder tr.liste_total td, tr.liste_total, form.liste_total {
/* background: #F0F0F0; */ height: 32px;
} }
.noborder tr.liste_total td, tr.liste_total td, form.liste_total div { .noborder tr.liste_total td, tr.liste_total td, form.liste_total div {
/* border-top: 1px solid #f4f4f4; */ /* border-top: 1px solid #f4f4f4; */
@ -2777,7 +2777,6 @@ input.liste_titre {
font-weight: normal; font-weight: normal;
white-space: nowrap; white-space: nowrap;
padding: 4px; padding: 4px;
height: 20px;
} }
tr.liste_sub_total, tr.liste_sub_total td { tr.liste_sub_total, tr.liste_sub_total td {
border-bottom: 2px solid #aaa; border-bottom: 2px solid #aaa;