Fix links

This commit is contained in:
Laurent Destailleur 2021-09-14 17:56:06 +02:00
parent 5f612dfd7c
commit 6dbf316e66
3 changed files with 18 additions and 9 deletions

View File

@ -31,16 +31,17 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
* Prepare array with list of tabs
*
* @param Project $project Object related to tabs
* @param string $moreparam More param on url
* @return array Array of tabs to show
*/
function project_prepare_head(Project $project)
function project_prepare_head(Project $project, $moreparam = '')
{
global $db, $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/projet/card.php?id='.$project->id;
$head[$h][0] = DOL_URL_ROOT.'/projet/card.php?id='.((int) $project->id).($moreparam ? '&'.$moreparam : '');
$head[$h][1] = $langs->trans("Project");
$head[$h][2] = 'project';
$h++;
@ -56,7 +57,7 @@ function project_prepare_head(Project $project)
$nbContacts = count($project->liste_contact(-1, 'internal')) + count($project->liste_contact(-1, 'external'));
dol_setcache($cachekey, $nbContacts, 120); // If setting cache fails, this is not a problem, so we do not test result.
}
$head[$h][0] = DOL_URL_ROOT.'/projet/contact.php?id='.$project->id;
$head[$h][0] = DOL_URL_ROOT.'/projet/contact.php?id='.((int) $project->id).($moreparam ? '&'.$moreparam : '');
$head[$h][1] = $langs->trans("ProjectContact");
if ($nbContacts > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContacts.'</span>';
@ -80,7 +81,7 @@ function project_prepare_head(Project $project)
$nbTasks = count($taskstatic->getTasksArray(0, 0, $project->id, 0, 0));
dol_setcache($cachekey, $nbTasks, 120); // If setting cache fails, this is not a problem, so we do not test result.
}
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks.php?id='.$project->id;
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks.php?id='.((int) $project->id).($moreparam ? '&'.$moreparam : '');
$head[$h][1] = $langs->trans("Tasks");
if ($nbTasks > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbTasks).'</span>';
@ -113,7 +114,7 @@ function project_prepare_head(Project $project)
}
}
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.urlencode($project->id);
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.((int) $project->id).($moreparam ? '&'.$moreparam : '');
$head[$h][1] = $langs->trans("TimeSpent");
if ($nbTimeSpent > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">...</span>';

View File

@ -502,7 +502,15 @@ if (($id || $ref) && $action == 'edit') {
// Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
$res = $object->fetch_optionals();
$object->fetch_optionals();
$moreparam = '';
if ($withproject) {
$moreparam .= '&withproject=1';
}
if ($fk_project) {
$moreparam .= '&fk_project='.((int) $fk_project);
}
$head = conferenceorboothattendeePrepareHead($object);
print dol_get_fiche_head($head, 'card', $langs->trans("ConferenceOrBoothAttendee"), -1, $object->picto);
@ -544,13 +552,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Object card
// ------------------------------------------------------------
$linkback = '<a href="'.dol_buildpath('/eventorganization/conferenceorboothattendee_list.php', 1).'?restore_lastsearch_values=1&conforboothid='.$confOrBooth->id .$withProjectUrl.'">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.dol_buildpath('/eventorganization/conferenceorboothattendee_list.php', 1).'?restore_lastsearch_values=1'.($confOrBooth->id > 0 ? '&conforboothid='.((int) $confOrBooth->id) : '').$moreparam.'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
$morehtmlref .= '</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $moreparam);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';

View File

@ -196,7 +196,7 @@ function conferenceorboothattendeePrepareHead($object)
$h = 0;
$head = array();
$head[$h][0] = dol_buildpath("/eventorganization/conferenceorboothattendee_card.php", 1).'?id='.$object->id.'&conforboothid='.$object->fk_actioncomm;
$head[$h][0] = DOL_URL_ROOT."/eventorganization/conferenceorboothattendee_card.php?id=".((int) $object->id).($object->fk_actioncomm > 0 ? '&conforboothid='.((int) $object->fk_actioncomm) : '').($object->fk_project > 0 ? '&withproject=1&fk_project='.((int) $object->fk_project) : '');
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;