NEW If module salaries is on, you can set a hourly value for tome

consumed by users. Each time a user enter its time consumed on a
project, a calculation is done to provide the cost for human services.
This value appears into the "Transversal view" of project.
This commit is contained in:
Laurent Destailleur
2015-06-03 21:01:50 +02:00
parent 995645800e
commit dd8a0b849a
11 changed files with 240 additions and 52 deletions

View File

@@ -1248,10 +1248,11 @@ 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 string $morefilter Add more filters into sql request
* @param string $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.
* @return string HTML select string
* @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)
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='')
{
global $conf,$user,$langs;
@@ -1347,8 +1348,8 @@ class Form
$userstatic->lastname=$obj->lastname;
$userstatic->firstname=$obj->firstname;
$disableline=0;
if (is_array($enableonly) && count($enableonly) && ! in_array($obj->rowid,$enableonly)) $disableline=1;
$disableline='';
if (is_array($enableonly) && count($enableonly) && ! in_array($obj->rowid,$enableonly)) $disableline=($enableonlytext?$enableonlytext:'1');
if ((is_object($selected) && $selected->id == $obj->rowid) || (! is_object($selected) && $selected == $obj->rowid))
{
@@ -1398,6 +1399,10 @@ class Form
}
}
$out.=($moreinfo?')':'');
if ($disableline && $disableline != '1')
{
$out.=' - '.$disableline; // This is text from $enableonlytext parameter
}
$out.= '</option>';
$i++;
@@ -4248,6 +4253,7 @@ class Form
$hourSelected=0; $minSelected=0;
// Hours
if ($iSecond != '')
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@@ -4278,6 +4284,7 @@ class Form
$retstring.=' '.$langs->trans('HourShort');
// Minutes
if ($minunderhours) $retstring.='<br>';
else $retstring.="&nbsp;";

View File

@@ -147,13 +147,15 @@ class FormProjets
$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
}
if (!empty($selected) && $selected == $obj->rowid && $obj->fk_statut > 0)
if (!empty($selected) && $selected == $obj->rowid)
{
$out.= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
$out.= '<option value="'.$obj->rowid.'" selected';
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
$out.= '>'.$labeltoshow.'</option>';
}
else
{
if ($hideunselectables && $disabled)
if ($hideunselectables && $disabled && ($selected != $obj->rowid))
{
$resultat='';
}
@@ -194,12 +196,14 @@ class FormProjets
*
* @param string $table_element Table of the element to update
* @param int $socid socid to filter
* @return string The HTML select list of element
* @return int|string The HTML select list of element or '' if nothing or -1 if KO
*/
function select_element($table_element,$socid=0)
{
global $conf, $langs;
if ($table_element == 'projet_task') return ''; // Special cas of element we never link to a project (already always done)
$projectkey="fk_projet";
switch ($table_element)
{

View File

@@ -2717,6 +2717,7 @@ function print_titre($title)
* @param int $pictoisfullpath 1=Icon name is a full absolute url of image
* @param int $id To force an id on html objects
* @return void
* @deprecated Use print load_fiche_titre instead
*/
function print_fiche_titre($title, $mesg='', $picto='title_generic.png', $pictoisfullpath=0, $id='')
{

View File

@@ -657,7 +657,10 @@ if (! empty($id) && $action != 'edit')
{
print '<tr>';
print '<td>'.$langs->trans("Project").'</td>';
print '<td>'.$object->projet.'</td>';
print '<td>';
$object->fetch_projet();
print $object->project->getNomUrl(4);
print '</td>';
print '</tr>';
}

View File

@@ -75,6 +75,7 @@ ListFichinterAssociatedProject=List of interventions associated with the project
ListExpenseReportsAssociatedProject=List of expense reports associated with the project
ListDonationsAssociatedProject=List of donations associated with the project
ListActionsAssociatedProject=List of events associated with the project
ListTaskTimeUserProject=List of time consumed on tasks of project
ActivityOnProjectThisWeek=Activity on project this week
ActivityOnProjectThisMonth=Activity on project this month
ActivityOnProjectThisYear=Activity on project this year
@@ -146,3 +147,5 @@ InputPerAction=Input per action
TimeAlreadyRecorded=Time spent already recorded for this task/day and user %s
ProjectsWithThisUserAsContact=Projects with this user as contact
TasksWithThisUserAsContact=Tasks assigned to this user
ResourceNotAssignedToProject=Not assigned to project
ResourceNotAssignedToTask=Not assigned to task

View File

@@ -601,7 +601,7 @@ else
if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
$text=$form->select_thirdparty_list($object->thirdparty->id,'socid',$filteronlist,1,1);
$texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty");
print $form->textwithtooltip($text.' '.img_help(),$texthelp,1);
print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2);
print '</td></tr>';
// Visibility

View File

@@ -406,13 +406,13 @@ class Project extends CommonObject
}
/**
* Return list of elements for type linked to project
* Return list of elements for type, linked to project
*
* @param string $type 'propal','order','invoice','order_supplier','invoice_supplier'
* @param string $type 'propal','order','invoice','order_supplier','invoice_supplier',...
* @param string $tablename name of table associated of the type
* @param string $datefieldname name of table associated of the type
* @param string $dates Start date (at 00:00:00)
* @param string $datee End date (at 23:00:00)
* @param string $datefieldname name of date field for filter
* @param string $dates Start date (ex 00:00:00)
* @param string $datee End date (ex 23:59:59)
* @return mixed Array list of object ids linked to project, < 0 or string if error
*/
function get_element_list($type, $tablename, $datefieldname='', $dates='', $datee='')
@@ -423,14 +423,23 @@ class Project extends CommonObject
{
$sql = "SELECT id as rowid FROM " . MAIN_DB_PREFIX . "actioncomm WHERE fk_project=" . $this->id;
}
elseif ($type == 'expensereport')
{
$sql = "SELECT ed.rowid FROM " . MAIN_DB_PREFIX . "expensereport as e, " . MAIN_DB_PREFIX . "expensereport_det as ed WHERE e.rowid = ed.fk_expensereport AND ed.fk_projet=" . $this->id;
}
elseif ($type == 'project_task')
{
$sql = "SELECT DISTINCT pt.rowid FROM " . MAIN_DB_PREFIX . "projet_task as pt, " . MAIN_DB_PREFIX . "projet_task_time as ptt WHERE pt.rowid = ptt.fk_task AND pt.fk_projet=" . $this->id;
}
elseif ($type == 'project_task_time') // Case we want to duplicate line foreach user
{
$sql = "SELECT DISTINCT pt.rowid, ptt.fk_user FROM " . MAIN_DB_PREFIX . "projet_task as pt, " . MAIN_DB_PREFIX . "projet_task_time as ptt WHERE pt.rowid = ptt.fk_task AND pt.fk_projet=" . $this->id;
}
else
{
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . $tablename." WHERE fk_projet=" . $this->id;
}
if ($type == 'expensereport')
{
$sql = "SELECT ed.rowid FROM " . MAIN_DB_PREFIX . "expensereport as e, " . MAIN_DB_PREFIX . "expensereport_det as ed WHERE e.rowid = ed.fk_expensereport AND ed.fk_projet=" . $this->id;
}
if ($dates > 0)
{
if (empty($datefieldname) && ! empty($this->table_element_date)) $datefieldname=$this->table_element_date;
@@ -458,7 +467,7 @@ class Project extends CommonObject
{
$obj = $this->db->fetch_object($result);
$elements[$i] = $obj->rowid;
$elements[$i] = $obj->rowid.(empty($obj->fk_user)?'':'_'.$obj->fk_user);
$i++;
}

View File

@@ -509,7 +509,7 @@ class Task extends CommonObject
$label = '<u>' . $langs->trans("ShowTask") . '</u>';
if (! empty($this->ref))
$label .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
if (! empty($this->title))
if (! empty($this->label))
$label .= '<br><b>' . $langs->trans('LabelTask') . ':</b> ' . $this->label;
if ($this->date_start || $this->date_end)
{
@@ -913,6 +913,59 @@ class Task extends CommonObject
}
}
/**
* Calculate vamue of time consumed using the thm (hourly amount value of work for user entering time)
*
* @param User $fuser Filter on a dedicated user
* @param string $dates Start date (ex 00:00:00)
* @param string $datee End date (ex 23:59:59)
* @return array Array of info for task array('amount')
*/
function getSumOfAmount($fuser='', $dates='', $datee='')
{
global $langs;
if (empty($id)) $id=$this->id;
$result=array();
$sql = "SELECT";
$sql.= " SUM(t.task_duration / 3600 * thm) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
$sql.= " WHERE t.fk_task = ".$id;
if (is_object($fuser) && $fuser->id > 0)
{
$sql.=" AND fk_user = ".$fuser->id;
}
if ($dates > 0)
{
$datefieldname="task_datehour";
$sql.=" AND (".$datefieldname." >= '".$this->db->idate($dates)."' OR ".$datefieldname." IS NULL)";
}
if ($datee > 0)
{
$datefieldname="task_datehour";
$sql.=" AND (".$datefieldname." <= '".$this->db->idate($datee)."' OR ".$datefieldname." IS NULL)";
}
dol_syslog(get_class($this)."::getSumOfAmount", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$obj = $this->db->fetch_object($resql);
$result['amount'] = $obj->amount;
$this->db->free($resql);
return $result;
}
else
{
dol_print_error($this->db);
return $result;
}
}
/**
* Load object in memory from database
*

View File

@@ -28,6 +28,7 @@
require '../main.inc.php';
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/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@@ -257,9 +258,18 @@ $listofreferent=array(
'class'=>'Don',
'margin'=>'add',
'table'=>'don',
'datefieldname'=>'date',
'datefieldname'=>'datedon',
'disableamount'=>0,
'test'=>$conf->don->enabled && $user->rights->don->lire),
'project_task'=>array(
'name'=>"TaskTimeValorised",
'title'=>"ListTaskTimeUserProject",
'class'=>'Task',
'margin'=>'minus',
'table'=>'projet_task',
'datefieldname'=>'task_date',
'disableamount'=>0,
'test'=>$conf->projet->enabled && $user->rights->projet->lire && $conf->salaries->enabled),
);
if ($action=="addelement")
@@ -281,6 +291,8 @@ if ($action=="addelement")
}
}
$elementuser = new User($db);
$showdatefilter=0;
foreach ($listofreferent as $key => $value)
{
@@ -292,15 +304,19 @@ foreach ($listofreferent as $key => $value)
if ($qualified)
{
// If we want the project task array to have details of users
//if ($key == 'project_task') $key = 'project_task_time';
$element = new $classname($db);
// Show the filter on date on top of element list
if (! $showdatefilter)
{
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$projectid.'" method="post">';
print '<input type="hidden" name="tablename" value="'.$tablename.'">';
print '<input type="hidden" name="action" value="view">';
print '<table><tr>';
//print '<td>'.$langs->trans("Filter").':</td>';
print '<td>'.$langs->trans("From").' ';
print $form->select_date($dates,'dates',0,0,1);
print '</td>';
@@ -325,7 +341,7 @@ foreach ($listofreferent as $key => $value)
{
setEventMessages($formproject->error,$formproject->errors,'errors');
}
else
elseif($selectList)
{
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$projectid.'" method="post">';
print '<input type="hidden" name="tablename" value="'.$tablename.'">';
@@ -341,20 +357,34 @@ foreach ($listofreferent as $key => $value)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
// Remove link
print '<td style="width: 24px"></td>';
// Ref
print '<td style="width: 200px">'.$langs->trans("Ref").'</td>';
print '<td width="100" align="center">'.$langs->trans("Date").'</td>';
// Date
print '<td width="100" align="center">';
if (! in_array($tablename, array('projet_task'))) print $langs->trans("Date");
print '</td>';
// Thirdparty or user
print '<td>';
if ($tablename == 'expensereport_det' || 'don') print $langs->trans("User");
if (in_array($tablename, array('projet_task')) && $key == 'project_task') print ''; // if $key == 'project_task', we don't want details per user
elseif (in_array($tablename, array('expensereport_det','don','projet_task'))) print $langs->trans("User");
else print $langs->trans("ThirdParty");
print '</td>';
// Amount HT
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td align="right" width="120">'.$langs->trans("AmountHT").'</td>';
//elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print '<td align="right" width="120">'.$langs->trans("Amount").'</td>';
if (empty($value['disableamount'])) print '<td align="right" width="120">'.$langs->trans("AmountHT").'</td>';
else print '<td width="120"></td>';
// Amount TTC
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td align="right" width="120">'.$langs->trans("AmountTTC").'</td>';
if (empty($value['disableamount'])) print '<td align="right" width="120">'.$langs->trans("AmountTTC").'</td>';
else print '<td width="120"></td>';
print '<td align="right" width="200">'.$langs->trans("Status").'</td>';
// Status
if (in_array($tablename, array('projet_task'))) print '<td align="right" width="200">'.$langs->trans("ProgressDeclared").'</td>';
else print '<td align="right" width="200">'.$langs->trans("Status").'</td>';
print '</tr>';
$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee);
if (is_array($elementarray) && count($elementarray)>0)
{
@@ -368,15 +398,21 @@ foreach ($listofreferent as $key => $value)
$saved_third_id = 0;
$breakline = '';
if (canApplySubtotalOn($tablename)) {
// Appel du mon code de tri :
if (canApplySubtotalOn($tablename))
{
// Sort
$elementarray = sortElementsByClientName($elementarray);
}
$num=count($elementarray);
for ($i = 0; $i < $num; $i++)
{
$element->fetch($elementarray[$i]);
$tmp=explode('_',$elementarray[$i]);
$idofelement=$tmp[0];
$idofelementuser=$tmp[1];
$element->fetch($idofelement);
if ($idofelementuser) $elementuser->fetch($idofelementuser);
if ($tablename != 'expensereport_det')
{
@@ -411,8 +447,12 @@ foreach ($listofreferent as $key => $value)
$var=!$var;
print "<tr ".$bc[$var].">";
// Remove link
print '<td style="width: 24px">';
if ($tablename != 'projet_task')
{
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $projectid . '&action=unlink&tablename=' . $tablename . '&elementselect=' . $element->id . '">' . img_picto($langs->trans('Unlink'), 'editdelete') . '</a>';
}
print "</td>\n";
// Ref
print '<td align="left">';
@@ -421,8 +461,10 @@ foreach ($listofreferent as $key => $value)
{
print $expensereport->getNomUrl(1);
}
else {
print $element->getNomUrl(1);
else
{
if ($element instanceof Task) print $element->getNomUrl(1,'withproject','time');
else print $element->getNomUrl(1);
$element_doc = $element->element;
$filename=dol_sanitizeFileName($element->ref);
@@ -439,13 +481,13 @@ foreach ($listofreferent as $key => $value)
}
print $formfile->getDocumentsLink($element_doc, $filename, $filedir);
}
print "</td>\n";
// Date
if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order') $date=$element->date_commande;
elseif ($tablename == 'projet_task') $date=''; // We show no date. Showing date of beginning of task make user think it is date of time consumed
else
{
$date=$element->date;
@@ -465,10 +507,17 @@ foreach ($listofreferent as $key => $value)
print $tmpuser->getNomUrl(1,'',48);
}
else if ($tablename == 'don')
{
if ($element->fk_user_author > 0)
{
$tmpuser2=new User($db);
$tmpuser2->fetch($don->fk_user_author);
$tmpuser2->fetch($element->fk_user_author);
print $tmpuser2->getNomUrl(1,'',48);
}
}
else if ($tablename == 'projet_task' && $key == 'project_task_time') // if $key == 'project_task', we don't want details per user
{
print $elementuser->getNomUrl(1);
}
print '</td>';
@@ -476,6 +525,11 @@ foreach ($listofreferent as $key => $value)
if (empty($value['disableamount']))
{
if ($tablename == 'don') $total_ht_by_line=$element->amount;
elseif ($tablename == 'projet_task')
{
$tmp = $element->getSumOfAmount($elementuser, $dates, $datee);
$total_ht_by_line = price2num($tmp['amount'],'MT');
}
else
{
$total_ht_by_line=$element->total_ht;
@@ -492,6 +546,11 @@ foreach ($listofreferent as $key => $value)
if (empty($value['disableamount']))
{
if ($tablename == 'don') $total_ttc_by_line=$element->amount;
elseif ($tablename == 'projet_task')
{
$defaultvat = get_default_tva($mysoc, $mysoc);
$total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)),'MT');
}
else
{
$total_ttc_by_line=$element->total_ttc;
@@ -506,10 +565,20 @@ foreach ($listofreferent as $key => $value)
// Status
print '<td align="right">';
if ($element instanceof CommonInvoice) {
if ($element instanceof CommonInvoice)
{
//This applies for Facture and FactureFournisseur
print $element->getLibStatut(5, $element->getSommePaiement());
} else {
}
else if ($element instanceof Task)
{
if ($element->progress != '')
{
print $element->progress.' %';
}
}
else
{
print $element->getLibStatut(5);
}
print '</td>';
@@ -548,8 +617,12 @@ foreach ($listofreferent as $key => $value)
if ($breakline) print $breakline;
print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Number").': '.$i.'</td>';
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td align="right" width="100">'.$langs->trans("TotalHT").' : '.price($total_ht).'</td>';
//elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print '<td align="right" width="100">'.$langs->trans("Total").' : '.price($total_ht).'</td>';
if (empty($value['disableamount'])) print '<td align="right" width="100">'.$langs->trans("TotalHT").' : '.price($total_ht).'</td>';
else print '<td></td>';
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td align="right" width="100">'.$langs->trans("TotalTTC").' : '.price($total_ttc).'</td>';
//elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print '<td align="right" width="100"></td>';
if (empty($value['disableamount'])) print '<td align="right" width="100">'.$langs->trans("TotalTTC").' : '.price($total_ttc).'</td>';
else print '<td></td>';
print '<td>&nbsp;</td>';
@@ -609,7 +682,10 @@ $langs->load("bills");
$langs->load("orders");
$langs->load("proposals");
$langs->load("margins");
print_fiche_titre($langs->trans("Profit"),'','title_accountancy');
//print load_fiche_titre($langs->trans("Profit"),'','title_accountancy');
print '<br><div class="center">'.img_picto("", "title_accountancy").' '.$langs->trans("Profit").'</div><br>';
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td align="left" width="200">'.$langs->trans("Element").'</td>';
@@ -624,30 +700,56 @@ foreach ($listofreferent as $key => $value)
$title=$value['title'];
$classname=$value['class'];
$tablename=$value['table'];
$datefieldname=$value['datefieldname'];
$qualified=$value['test'];
$margin = $value['margin'];
if ($qualified && isset($margin)) // If this element must be included into profit calculation ($margin is 'minus' or 'plus')
{
$element = new $classname($db);
$elementarray = $object->get_element_list($key, $tablename);
$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee);
if (count($elementarray)>0 && is_array($elementarray))
{
$var=true;
$total_ht = 0;
$total_ttc = 0;
$num=count($elementarray);
for ($i = 0; $i < $num; $i++)
{
$element->fetch($elementarray[$i]);
$tmp=explode('_',$elementarray[$i]);
$idofelement=$tmp[0];
$idofelementuser=$tmp[1];
$element->fetch($idofelement);
if ($idofelementuser) $elementuser->fetch($idofelementuser);
if ($tablename != 'expensereport_det') $element->fetch_thirdparty();
if ($tablename == 'don') $total_ht_by_line=$element->amount;
elseif ($tablename == 'projet_task')
{
if ($idofelementuser)
{
$tmp = $element->getSumOfAmount($elementuser, $dates, $datee);
$total_ht_by_line = price2num($tmp['amount'],'MT');
}
else
{
$tmp = $element->getSumOfAmount('', $dates, $datee);
$total_ht_by_line = price2num($tmp['amount'],'MT');
}
}
else $total_ht_by_line=$element->total_ht;
$total_ht = $total_ht + $total_ht_by_line;
if ($tablename == 'don') $total_ttc_by_line=$element->amount;
elseif ($tablename == 'projet_task')
{
$defaultvat = get_default_tva($mysoc, $mysoc);
$total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)),'MT');
}
else $total_ttc_by_line=$element->total_ttc;
$total_ttc = $total_ttc + $total_ttc_by_line;
@@ -695,10 +797,14 @@ foreach ($listofreferent as $key => $value)
$newclassname = $classname;
}
print '<tr >';
print '<tr>';
// Module
print '<td align="left">'.$langs->trans($newclassname).'</td>';
// Nb
print '<td align="right">'.$i.'</td>';
// Amount HT
print '<td align="right">'.price($total_ht).'</td>';
// Amount TTC
print '<td align="right">'.price($total_ttc).'</td>';
print '</tr>';
}

View File

@@ -298,12 +298,13 @@ if ($id > 0 || ! empty($ref))
if ($res) break;
}
*/
print '<table class="noborder" width="100%">';
/*
* Add a new contact line
* Non affiche en mode modification de ligne
*/
print '<table class="noborder" width="100%">';
if ($action != 'editline' && $user->rights->projet->creer)
{
print '<tr class="liste_titre">';
@@ -336,8 +337,9 @@ if ($id > 0 || ! empty($ref))
print '<td colspan="1">';
// On recupere les id des users deja selectionnes
$contactsofproject=$projectstatic->getListContactId('internal');
print $form->select_dolusers((GETPOST('contactid')?GETPOST('contactid'):$user->id), 'contactid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 1);
if ($object->project->public) $contactsofproject=''; // Everybody
else $contactsofproject=$projectstatic->getListContactId('internal');
print $form->select_dolusers((GETPOST('contactid')?GETPOST('contactid'):$user->id), 'contactid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 1, $langs->trans("ResourceNotAssignedToProject"));
print '</td>';
print '<td>';
$formcompany->selectTypeContact($object, '', 'type','internal','rowid');

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
@@ -369,7 +369,7 @@ if ($id > 0 || ! empty($ref))
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
print '<table class="noborder" width="100%">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre">';
print '<td width="100">'.$langs->trans("Date").'</td>';
@@ -395,7 +395,7 @@ if ($id > 0 || ! empty($ref))
if (count($contactsoftask)>0)
{
$userid=$contactsoftask[0];
print $form->select_dolusers((GETPOST('userid')?GETPOST('userid'):$userid),'userid',0,'',0,'',$contactsoftask);
print $form->select_dolusers((GETPOST('userid')?GETPOST('userid'):$userid), 'userid', 0, '', 0, '', $contactsoftask, 0, 0, 0, '', 0, $langs->trans("ResourceNotAssignedToTask"));
}
else
{