Fix several pb in links to projects on create page
This commit is contained in:
parent
9314dcb046
commit
1251807f54
@ -598,6 +598,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$formproject=new FormProjets($db);
|
||||
|
||||
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
||||
@ -871,11 +872,8 @@ if ($action == 'create')
|
||||
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td>';
|
||||
|
||||
$numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1),GETPOST("projectid")?GETPOST("projectid"):'','projectid');
|
||||
if ($numproject==0)
|
||||
{
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>';
|
||||
}
|
||||
$numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1), GETPOST("projectid")?GETPOST("projectid"):'', 'projectid', 0, 0, 1, 1);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
if (!empty($origin) && !empty($originid))
|
||||
|
||||
@ -1494,7 +1494,7 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled) && $socid > 0)
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$projectid = GETPOST('projectid')?GETPOST('projectid'):0;
|
||||
if ($origin == 'project') $projectid = ($originid ? $originid : 0);
|
||||
@ -1502,7 +1502,7 @@ if ($action == 'create')
|
||||
$langs->load("projects");
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("Project") . '</td><td>';
|
||||
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
|
||||
$numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -1600,12 +1600,12 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// TODO How record was recorded OrderMode (llx_c_input_method)
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled) && $socid > 0)
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("Project") . '</td><td>';
|
||||
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
|
||||
$numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -1090,7 +1090,7 @@ if ($action == 'create')
|
||||
$objectsrc->fetch(GETPOST('originid'));
|
||||
if (empty($objectsrc->lines) && method_exists($objectsrc,'fetch_lines')) $objectsrc->fetch_lines();
|
||||
$objectsrc->fetch_thirdparty();
|
||||
|
||||
|
||||
// Replicate extrafields
|
||||
$objectsrc->fetch_optionals($originid);
|
||||
$object->array_options = $objectsrc->array_options;
|
||||
@ -1193,10 +1193,13 @@ if ($action == 'create')
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load('projects');
|
||||
|
||||
$formproject=new FormProjets($db);
|
||||
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||
$formproject->select_projects(($soc->id>0?$soc->id:-1),$projectid,"projectid",0,0,1,1);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
|
||||
@ -191,7 +191,10 @@ class FormActions
|
||||
|
||||
$urlbacktopage=$_SERVER['PHP_SELF'].'?id='.$object->id.($moreparambacktopage?'&'.$moreparambacktopage:'');
|
||||
|
||||
$buttontoaddnewevent = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(),'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.'&socid='.$object->socid.'&projectid='.$object->fk_project.'&backtopage='.urlencode($urlbacktopage).'">';
|
||||
$projectid = $object->fk_project;
|
||||
if ($typeelement == 'project') $projectid = $object->id;
|
||||
|
||||
$buttontoaddnewevent = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(),'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid>0?'&socid='.$object->socid:'').($projectid>0?'&projectid='.$projectid:'').'&backtopage='.urlencode($urlbacktopage).'">';
|
||||
$buttontoaddnewevent.= $langs->trans("AddEvent");
|
||||
$buttontoaddnewevent.= '</a>';
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ class FormProjets
|
||||
global $langs,$conf,$form;
|
||||
|
||||
$out='';
|
||||
var_dump($conf->global->PROJECT_USE_SEARCH_TO_SELECT);
|
||||
|
||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT))
|
||||
{
|
||||
$placeholder='';
|
||||
@ -92,13 +92,13 @@ class FormProjets
|
||||
else
|
||||
{
|
||||
$out.=$this->select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, $discard_closed, $forcefocus, $disabled, 0, $filterkey, 1, $forceaddid, $htmlid);
|
||||
if ($discard_closed)
|
||||
}
|
||||
if ($discard_closed)
|
||||
{
|
||||
if (class_exists('Form'))
|
||||
{
|
||||
if (class_exists('Form'))
|
||||
{
|
||||
if (empty($form)) $form=new Form($this->db);
|
||||
$out.=$form->textwithpicto('', $langs->trans("ClosedProjectsAreHidden"));
|
||||
}
|
||||
if (empty($form)) $form=new Form($this->db);
|
||||
$out.=$form->textwithpicto('', $langs->trans("ClosedProjectsAreHidden"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1520,6 +1520,8 @@ if ($action=='create')
|
||||
$langs->load('projects');
|
||||
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
|
||||
$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$societe->id).'">' . $langs->trans("AddProject") . '</a>';
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -1097,7 +1097,9 @@ if ($action == 'create')
|
||||
print "</td></tr>";
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled) && $socid > 0) {
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
|
||||
$formproject = new FormProjets($db);
|
||||
|
||||
@ -1108,11 +1110,9 @@ if ($action == 'create')
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">' . $langs->trans("Project") . '</td><td colspan="2">';
|
||||
|
||||
$numprojet = $formproject->select_projects($soc->id, $projectid);
|
||||
if ($numprojet == 0) {
|
||||
$langs->load("projects");
|
||||
print ' <a href="../projet/card.php?socid=' . $soc->id . '&action=create">' . $langs->trans("AddProject") . '</a>';
|
||||
}
|
||||
$numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user