FIX Non expected switch from tab timesptent to tab tasks
This commit is contained in:
parent
e26124bf84
commit
95cf8b6359
@ -318,7 +318,7 @@ class FormProjets
|
||||
* @param string $projectsListId ''=Automatic filter on project allowed. List of id=Filter on project ids.
|
||||
* @param string $showproject 'all' = Show project info, ''=Hide project info
|
||||
* @param User $usertofilter User object to use for filtering
|
||||
* @return int Nbr of project if OK, <0 if KO
|
||||
* @return int Nbr of tasks if OK, <0 if KO
|
||||
*/
|
||||
public function selectTasks($socid = -1, $selected = '', $htmlname = 'taskid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null)
|
||||
{
|
||||
|
||||
@ -89,7 +89,7 @@ if ($permission)
|
||||
if (empty($hideaddcontactforuser))
|
||||
{
|
||||
?>
|
||||
<form class="tagtr impair" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>" method="POST">
|
||||
<form class="tagtr impair nohover" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>" method="POST">
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
|
||||
<input type="hidden" name="id" value="<?php echo $object->id; ?>" />
|
||||
<input type="hidden" name="action" value="addcontact" />
|
||||
@ -115,7 +115,7 @@ if ($permission)
|
||||
{
|
||||
?>
|
||||
|
||||
<form class="tagtr pair" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>" method="POST">
|
||||
<form class="tagtr pair nohover" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>" method="POST">
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
|
||||
<input type="hidden" name="id" value="<?php echo $object->id; ?>" />
|
||||
<input type="hidden" name="action" value="addcontact" />
|
||||
|
||||
@ -186,7 +186,7 @@ PlannedWorkload=Planned workload
|
||||
PlannedWorkloadShort=Workload
|
||||
ProjectReferers=Related items
|
||||
ProjectMustBeValidatedFirst=Project must be validated first
|
||||
FirstAddRessourceToAllocateTime=Assign a user resource to task to allocate time
|
||||
FirstAddRessourceToAllocateTime=Assign a user resource as contact of project to allocate time
|
||||
InputPerDay=Input per day
|
||||
InputPerWeek=Input per week
|
||||
InputPerMonth=Input per month
|
||||
|
||||
@ -131,6 +131,7 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -358,7 +359,7 @@ if ($id > 0 || !empty($ref))
|
||||
$head = project_prepare_head($object);
|
||||
dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($object->public ? 'projectpub' : 'project'));
|
||||
|
||||
$param = 'id='.$object->id;
|
||||
$param = '&id='.$object->id;
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($search_user_id) $param .= '&search_user_id='.urlencode($search_user_id);
|
||||
if ($search_taskref) $param .= '&search_taskref='.urlencode($search_taskref);
|
||||
@ -634,7 +635,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
}
|
||||
}
|
||||
|
||||
$linktocreatetask = dolGetButtonTitle($langs->trans('AddTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id.'&action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id), '', $linktocreatetaskUserRight, $linktocreatetaskParam);
|
||||
$linktocreatetask = dolGetButtonTitle($langs->trans('AddTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id), '', $linktocreatetaskUserRight, $linktocreatetaskParam);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -686,7 +687,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table id="tablelines" class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">';
|
||||
print '<table id="tablelines" class="tagtable nobottom liste'.($moreforfilter ? " listwithfilterbefore" : "").'">';
|
||||
|
||||
// Fields title search
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
@ -374,7 +374,7 @@ if ($id > 0 || !empty($ref))
|
||||
if ($action != 'editline' && $user->rights->projet->creer)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Nature").'</td>';
|
||||
print '<td>'.$langs->trans("NatureOfContact").'</td>';
|
||||
print '<td>'.$langs->trans("ThirdParty").'</td>';
|
||||
print '<td>'.$langs->trans("Users").'</td>';
|
||||
print '<td>'.$langs->trans("ContactType").'</td>';
|
||||
@ -389,7 +389,7 @@ if ($id > 0 || !empty($ref))
|
||||
if ($withproject) print '<input type="hidden" name="withproject" value="'.$withproject.'">';
|
||||
|
||||
// Ligne ajout pour contact interne
|
||||
print '<tr class="oddeven">';
|
||||
print '<tr class="oddeven nohover">';
|
||||
|
||||
print '<td class="nowrap">';
|
||||
print img_object('', 'user').' '.$langs->trans("Users");
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
@ -53,6 +53,7 @@ $projectid = GETPOST('projectid', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$withproject = GETPOST('withproject', 'int');
|
||||
$project_ref = GETPOST('project_ref', 'alpha');
|
||||
$tab = GETPOST('tab', 'aZ09');
|
||||
|
||||
$search_day = GETPOST('search_day', 'int');
|
||||
$search_month = GETPOST('search_month', 'int');
|
||||
@ -620,8 +621,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
|
||||
if ($withproject)
|
||||
{
|
||||
// Tabs for project
|
||||
if (empty($id)) $tab = 'timespent';
|
||||
if (empty($id) || $tab == 'timespent') $tab = 'timespent';
|
||||
else $tab = 'tasks';
|
||||
|
||||
$head = project_prepare_head($projectstatic);
|
||||
dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'));
|
||||
|
||||
@ -958,6 +960,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '<input type="hidden" name="projectid" value="'.$projectidforalltimes.'">';
|
||||
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
|
||||
print '<input type="hidden" name="tab" value="'.$tab.'">';
|
||||
|
||||
if ($massaction == 'generateinvoice')
|
||||
{
|
||||
@ -1139,7 +1142,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<tr class="oddeven nohover">';
|
||||
|
||||
// Date
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
@ -1149,28 +1152,31 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
|
||||
print '</td>';
|
||||
|
||||
// Task
|
||||
$nboftasks = 0;
|
||||
if (empty($id))
|
||||
{
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
$formproject->selectTasks(-1, GETPOST('taskid', 'int'), 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, '');
|
||||
$nboftasks = $formproject->selectTasks(-1, GETPOST('taskid', 'int'), 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, '');
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Contributor
|
||||
print '<td class="maxwidthonsmartphone nowraponall">';
|
||||
print img_object('', 'user', 'class="hideonsmartphone"');
|
||||
$contactsofproject = $projectstatic->getListContactId('internal');
|
||||
if (count($contactsofproject) > 0)
|
||||
{
|
||||
print img_object('', 'user', 'class="hideonsmartphone"');
|
||||
if (in_array($user->id, $contactsofproject)) $userid = $user->id;
|
||||
else $userid = $contactsofproject[0];
|
||||
|
||||
if ($projectstatic->public) $contactsofproject = array();
|
||||
print $form->select_dolusers((GETPOST('userid', 'int') ?GETPOST('userid', 'int') : $userid), 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, $langs->trans("ResourceNotAssignedToProject"), 'maxwidth200');
|
||||
print $form->select_dolusers((GETPOST('userid', 'int') ? GETPOST('userid', 'int') : $userid), 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, $langs->trans("ResourceNotAssignedToProject"), 'maxwidth200');
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime');
|
||||
if ($nboftasks) {
|
||||
print img_error($langs->trans('FirstAddRessourceToAllocateTime')).' '.$langs->trans('FirstAddRessourceToAllocateTime');
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -1202,8 +1208,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
|
||||
}
|
||||
|
||||
print '<td class="center">';
|
||||
print '<input type="submit" name="save" class="button buttongen marginleftonly marginbottomonly" value="'.$langs->trans("Add").'">';
|
||||
print '<input type="submit" name="cancel" class="button buttongen marginleftonly" value="'.$langs->trans("Cancel").'">';
|
||||
print '<input type="submit" name="save" class="button buttongen marginleftonly margintoponlyshort marginbottomonlyshort" value="'.$langs->trans("Add").'">';
|
||||
print '<input type="submit" name="cancel" class="button buttongen marginleftonly margintoponlyshort marginbottomonlyshort" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -1504,9 +1510,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
|
||||
if (($action == 'editline' || $action == 'splitline') && $_GET['lineid'] == $task_time->rowid)
|
||||
{
|
||||
print '<input type="hidden" name="lineid" value="'.$_GET['lineid'].'">';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print '<input type="submit" class="button buttongen margintoponlyshort marginbottomonlyshort" name="save" value="'.$langs->trans("Save").'">';
|
||||
print '<br>';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">';
|
||||
print '<input type="submit" class="button buttongen margintoponlyshort marginbottomonlyshort" name="cancel" value="'.$langs->trans('Cancel').'">';
|
||||
}
|
||||
elseif ($user->rights->projet->lire || $user->rights->projet->all->creer) // Read project and enter time consumed on assigned tasks
|
||||
{
|
||||
@ -1515,19 +1521,19 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
|
||||
if ($conf->MAIN_FEATURES_LEVEL >= 2)
|
||||
{
|
||||
print ' ';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=splitline&lineid='.$task_time->rowid.$param.'">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=splitline&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
|
||||
print img_split();
|
||||
print '</a>';
|
||||
}
|
||||
|
||||
print ' ';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=editline&lineid='.$task_time->rowid.$param.'">';
|
||||
print '<a class="reposition editfielda" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=editline&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
|
||||
print ' ';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=deleteline&lineid='.$task_time->rowid.$param.'">';
|
||||
print img_delete();
|
||||
print '<a class="reposition paddingleft" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=deleteline&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
|
||||
print img_delete('default', 'class="pictodelete paddingleft"');
|
||||
print '</a>';
|
||||
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
@ -1544,6 +1550,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
// Add line to split
|
||||
|
||||
if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid)
|
||||
|
||||
@ -798,9 +798,15 @@ select.flat.selectlimit {
|
||||
.margintoponly {
|
||||
margin-top: 10px !important;
|
||||
}
|
||||
.margintoponlyshort {
|
||||
margin-top: 3px !important;
|
||||
}
|
||||
.marginbottomonly {
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
.marginbottomonlyshort {
|
||||
margin-bottom: 3px !important;
|
||||
}
|
||||
.nomargintop {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user