Fix: merge problem

This commit is contained in:
Regis Houssin 2013-04-22 14:47:37 +02:00
parent 7883e4f0eb
commit 5ccb4108d4

View File

@ -51,6 +51,19 @@ if ($user->societe_id > 0)
$socid = $user->societe_id; $socid = $user->societe_id;
} }
$act = new ActionComm($db);
if ($objectid > 0)
{
$ret = $act->fetch($objectid);
if ($ret > 0) {
$company=new Societe($db);
$company->fetch($act->societe->id);
$act->societe=$company; // For backward compatibility
$act->thirdparty=$company;
}
}
// Get parameters // Get parameters
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
@ -79,7 +92,7 @@ if ($action == 'delete')
{ {
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($objectid); $upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($objectid);
$file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret=dol_delete_file($file); $ret=dol_delete_file($file,0,0,0,$act);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
$action=''; $action='';
@ -96,17 +109,10 @@ $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
llxHeader('',$langs->trans("Agenda"),$help_url); llxHeader('',$langs->trans("Agenda"),$help_url);
if ($objectid > 0) if ($act->id > 0)
{ {
$act = new ActionComm($db);
if ($act->fetch($objectid))
{
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($objectid); $upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($objectid);
$company=new Societe($db);
$company->fetch($act->societe->id);
$act->societe=$company;
$author=new User($db); $author=new User($db);
$author->fetch($act->author->id); $author->fetch($act->author->id);
$act->author=$author; $act->author=$author;
@ -269,11 +275,6 @@ if ($objectid > 0)
// List of document // List of document
$param='&id='.$act->id; $param='&id='.$act->id;
$formfile->list_of_documents($filearray,$act,'actions',$param,0,'',$user->rights->agenda->myactions->create); $formfile->list_of_documents($filearray,$act,'actions',$param,0,'',$user->rights->agenda->myactions->create);
}
else
{
dol_print_error($db);
}
} }
else else
{ {