Fix: param to set id of object into url must be id everywhere (except

company, it might be socid)
This commit is contained in:
Laurent Destailleur 2015-03-02 02:14:18 +01:00
parent 5a541c4206
commit 45a90b54fe

View File

@ -52,7 +52,7 @@ if (! empty($conf->ficheinter->enabled)) $langs->load("interventions");
if (! empty($conf->deplacement->enabled)) $langs->load("trips"); if (! empty($conf->deplacement->enabled)) $langs->load("trips");
if (! empty($conf->expensereport->enabled)) $langs->load("trips"); if (! empty($conf->expensereport->enabled)) $langs->load("trips");
$projectid=GETPOST('id','int'); $id=GETPOST('id','int');
$ref=GETPOST('ref','alpha'); $ref=GETPOST('ref','alpha');
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$datesrfc=GETPOST('datesrfc'); $datesrfc=GETPOST('datesrfc');
@ -69,7 +69,7 @@ if (! isset($_POST['datesrfc']) && ! isset($_POST['datesday']) && ! empty($conf-
//$dates=dol_time_plus_duree($datee, -1, 'y'); //$dates=dol_time_plus_duree($datee, -1, 'y');
$dates=dol_get_first_day($tmp['year'],1); $dates=dol_get_first_day($tmp['year'],1);
} }
if ($projectid == '' && $ref == '') if ($id == '' && $projectid == '' && $ref == '')
{ {
dol_print_error('','Bad parameter'); dol_print_error('','Bad parameter');
exit; exit;
@ -78,18 +78,22 @@ if ($projectid == '' && $ref == '')
$mine = $_REQUEST['mode']=='mine' ? 1 : 0; $mine = $_REQUEST['mode']=='mine' ? 1 : 0;
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$projectid=$id; // For backward compatibility
$project = new Project($db); $project = new Project($db);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
$project->fetch($id,$ref); $ret=$project->fetch($id,$ref);
$project->fetch_thirdparty(); if ($ret > 0)
{
$projectid=$project->id; $projectid=$project->id;
$project->fetch_thirdparty();
} }
else else
{ {
$project->fetch($projectid); setEventMessages($project->error, $project->errors, 'errors');
$project->fetch_thirdparty(); $action='';
$projectid=$project->id; }
} }
// Security check // Security check