diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php
index e6e3de8e4e6..236e016f580 100755
--- a/htdocs/comm/action/document.php
+++ b/htdocs/comm/action/document.php
@@ -193,7 +193,7 @@ if ($objectid > 0)
// Affiche formulaire upload
$formfile=new FormFile($db);
- $formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/action/document.php?id='.$act->id,'',0,0,($user->rights->agenda->myactions->create||$user->rights->agenda->actions->create));
+ $formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/action/document.php?id='.$act->id,'',0,0,($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create));
// List of document
diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php
index 0ef8572f9e0..5e306f20b03 100644
--- a/htdocs/comm/action/fiche.php
+++ b/htdocs/comm/action/fiche.php
@@ -43,8 +43,8 @@ $langs->load("agenda");
// Security check
if ($user->societe_id > 0)
{
- $action = '';
- $socid = $user->societe_id;
+ $action = '';
+ $socid = $user->societe_id;
}
if (isset($_GET["error"])) $error=$_GET["error"];
@@ -59,12 +59,12 @@ $contact = new Contact($db);
*/
if ($_POST["action"] == 'add_action')
{
- if ($_POST["contactid"])
- {
- $result=$contact->fetch($_POST["contactid"]);
- }
+ if ($_POST["contactid"])
+ {
+ $result=$contact->fetch($_POST["contactid"]);
+ }
- if ($_POST['cancel'])
+ if ($_POST['cancel'])
{
$backtopage='';
if (! empty($_POST["backtopage"])) $backtopage=$_POST["backtopage"];
@@ -87,45 +87,45 @@ if ($_POST["action"] == 'add_action')
//if ($_POST["a2hour"] == -1) $_POST["a2hour"]='0';
//if ($_POST["a2min"] == -1) $_POST["a2min"]='0';
$datep=dol_mktime($_POST["aphour"],
- $_POST["apmin"],
- 0,
- $_POST["apmonth"],
- $_POST["apday"],
- $_POST["apyear"]);
+ $_POST["apmin"],
+ 0,
+ $_POST["apmonth"],
+ $_POST["apday"],
+ $_POST["apyear"]);
$datep2=dol_mktime($_POST["p2hour"],
- $_POST["p2min"],
- 0,
- $_POST["p2month"],
- $_POST["p2day"],
- $_POST["p2year"]);
+ $_POST["p2min"],
+ 0,
+ $_POST["p2month"],
+ $_POST["p2day"],
+ $_POST["p2year"]);
/*$datea=dol_mktime($_POST["adhour"], // deprecated
- $_POST["admin"],
- 0,
- $_POST["admonth"],
- $_POST["adday"],
- $_POST["adyear"]);
- $datea2=dol_mktime($_POST["a2hour"], // deprecated
- $_POST["a2min"],
- 0,
- $_POST["a2month"],
- $_POST["a2day"],
- $_POST["a2year"]);
- */
+ $_POST["admin"],
+ 0,
+ $_POST["admonth"],
+ $_POST["adday"],
+ $_POST["adyear"]);
+ $datea2=dol_mktime($_POST["a2hour"], // deprecated
+ $_POST["a2min"],
+ 0,
+ $_POST["a2month"],
+ $_POST["a2day"],
+ $_POST["a2year"]);
+ */
if (! $datep2 && $_POST["percentage"] == 100)
{
$error=1;
- $_GET["action"] = 'create';
- $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("DateEnd")).'
';
+ $_GET["action"] = 'create';
+ $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("DateEnd")).'
';
}
// Initialisation objet cactioncomm
- if (! $_POST["actioncode"])
- {
- $error=1;
+ if (! $_POST["actioncode"])
+ {
+ $error=1;
$_GET["action"] = 'create';
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("Type")).'
';
- }
+ $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("Type")).'
';
+ }
else
{
$result=$cactioncomm->fetch($_POST["actioncode"]);
@@ -206,68 +206,68 @@ if ($_POST["action"] == 'add_action')
{
$error=1;
$_GET["action"] = 'create';
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->transnoentities("DateEnd")).'
';
+ $mesg=''.$langs->trans("ErrorFieldRequired",$langs->transnoentities("DateEnd")).'
';
}
if ($datea && $_POST["percentage"] == 0)
{
$error=1;
$_GET["action"] = 'create';
- $mesg=''.$langs->trans("ErrorStatusCantBeZeroIfStarted").'
';
+ $mesg=''.$langs->trans("ErrorStatusCantBeZeroIfStarted").'
';
}
- if (! $_POST["apyear"] && ! $_POST["adyear"])
- {
- $error=1;
+ if (! $_POST["apyear"] && ! $_POST["adyear"])
+ {
+ $error=1;
$_GET["action"] = 'create';
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
';
- }
+ $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
';
+ }
- if (! $error)
- {
- $db->begin();
+ if (! $error)
+ {
+ $db->begin();
- // On cree l'action
- $idaction=$actioncomm->add($user);
+ // On cree l'action
+ $idaction=$actioncomm->add($user);
- if ($idaction > 0)
- {
- if (! $actioncomm->error)
- {
- $db->commit();
- if ($_POST["from"])
- {
+ if ($idaction > 0)
+ {
+ if (! $actioncomm->error)
+ {
+ $db->commit();
+ if ($_POST["from"])
+ {
dol_syslog("Back to ".$_POST["from"]);
- Header("Location: ".$_POST["from"]);
- }
- elseif($idaction)
- {
- Header("Location: ".DOL_URL_ROOT.'/comm/action/fiche.php?id='.$idaction);
- }
- else
- {
- Header("Location: ".DOL_URL_ROOT.'/comm/action/index.php');
- }
- exit;
- }
- else
- {
- // Si erreur
- $db->rollback();
- $_GET["id"]=$idaction;
+ Header("Location: ".$_POST["from"]);
+ }
+ elseif($idaction)
+ {
+ Header("Location: ".DOL_URL_ROOT.'/comm/action/fiche.php?id='.$idaction);
+ }
+ else
+ {
+ Header("Location: ".DOL_URL_ROOT.'/comm/action/index.php');
+ }
+ exit;
+ }
+ else
+ {
+ // Si erreur
+ $db->rollback();
+ $_GET["id"]=$idaction;
$langs->load("errors");
- $error=$langs->trans($actioncomm->error);
- }
- }
- else
- {
- $db->rollback();
- $_GET["id"]=$idaction;
+ $error=$langs->trans($actioncomm->error);
+ }
+ }
+ else
+ {
+ $db->rollback();
+ $_GET["id"]=$idaction;
$langs->load("errors");
- $error=$langs->trans($actioncomm->error);
- }
- }
+ $error=$langs->trans($actioncomm->error);
+ }
+ }
-// print $_REQUEST["from"]."rr";
+ // print $_REQUEST["from"]."rr";
}
/*
@@ -276,19 +276,19 @@ if ($_POST["action"] == 'add_action')
*/
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
{
- $actioncomm = new ActionComm($db);
- $actioncomm->fetch($_GET["id"]);
- $result=$actioncomm->delete();
+ $actioncomm = new ActionComm($db);
+ $actioncomm->fetch($_GET["id"]);
+ $result=$actioncomm->delete();
if ($result >= 0)
{
- Header("Location: index.php");
- exit;
- }
- else
- {
- $mesg=$actioncomm->error;
- }
+ Header("Location: index.php");
+ exit;
+ }
+ else
+ {
+ $mesg=$actioncomm->error;
+ }
}
/*
@@ -297,9 +297,9 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
*/
if ($_POST["action"] == 'update')
{
- if (! $_POST["cancel"])
- {
- // Clean parameters
+ if (! $_POST["cancel"])
+ {
+ // Clean parameters
if ($_POST["aphour"] == -1) $_POST["aphour"]='0';
if ($_POST["apmin"] == -1) $_POST["apmin"]='0';
if ($_POST["p2hour"] == -1) $_POST["p2hour"]='0';
@@ -307,66 +307,66 @@ if ($_POST["action"] == 'update')
//if ($_POST["adhour"] == -1) $_POST["adhour"]='0';
//if ($_POST["admin"] == -1) $_POST["admin"]='0';
- $actioncomm = new Actioncomm($db);
- $actioncomm->fetch($_POST["id"]);
+ $actioncomm = new Actioncomm($db);
+ $actioncomm->fetch($_POST["id"]);
- $datep=dol_mktime($_POST["aphour"],
- $_POST["apmin"],
- 0,
- $_POST["apmonth"],
- $_POST["apday"],
- $_POST["apyear"]);
+ $datep=dol_mktime($_POST["aphour"],
+ $_POST["apmin"],
+ 0,
+ $_POST["apmonth"],
+ $_POST["apday"],
+ $_POST["apyear"]);
$datep2=dol_mktime($_POST["p2hour"],
- $_POST["p2min"],
- 0,
- $_POST["p2month"],
- $_POST["p2day"],
- $_POST["p2year"]);
- /*$datea=dol_mktime($_POST["adhour"],
- $_POST["admin"],
- 0,
- $_POST["admonth"],
- $_POST["adday"],
- $_POST["adyear"]);
- $datea2=dol_mktime($_POST["a2hour"],
- $_POST["a2min"],
- 0,
- $_POST["a2month"],
- $_POST["a2day"],
- $_POST["a2year"]);
- */
+ $_POST["p2min"],
+ 0,
+ $_POST["p2month"],
+ $_POST["p2day"],
+ $_POST["p2year"]);
+ /*$datea=dol_mktime($_POST["adhour"],
+ $_POST["admin"],
+ 0,
+ $_POST["admonth"],
+ $_POST["adday"],
+ $_POST["adyear"]);
+ $datea2=dol_mktime($_POST["a2hour"],
+ $_POST["a2min"],
+ 0,
+ $_POST["a2month"],
+ $_POST["a2day"],
+ $_POST["a2year"]);
+ */
//print $_POST["apmonth"].",".$_POST["apday"].",".$_POST["apyear"].",".$_POST["aphour"].",".$_POST["apmin"]."
\n";
//print $actioncomm->datep;
- //print 'dddd'.$datep;
- $actioncomm->label = $_POST["label"];
+ //print 'dddd'.$datep;
+ $actioncomm->label = $_POST["label"];
$actioncomm->datep = $datep;
$actioncomm->datef = $datep2;
//$actioncomm->date = $datea;
//$actioncomm->dateend = $datea2;
- $actioncomm->percentage = $_POST["percentage"];
- $actioncomm->priority = $_POST["priority"];
+ $actioncomm->percentage = $_POST["percentage"];
+ $actioncomm->priority = $_POST["priority"];
$actioncomm->location = isset($_POST["location"])?$_POST["location"]:'';
- $actioncomm->societe->id = $_POST["socid"];
- $actioncomm->contact->id = $_POST["contactid"];
- $actioncomm->note = $_POST["note"];
+ $actioncomm->societe->id = $_POST["socid"];
+ $actioncomm->contact->id = $_POST["contactid"];
+ $actioncomm->note = $_POST["note"];
- if (! $datep2 && $_POST["percentage"] == 100)
- {
- $error=$langs->trans("ErrorFieldRequired",$langs->trans("DateEnd"));
+ if (! $datep2 && $_POST["percentage"] == 100)
+ {
+ $error=$langs->trans("ErrorFieldRequired",$langs->trans("DateEnd"));
$_REQUEST["action"] = 'edit';
- }
+ }
// Users
$usertodo=new User($db,$_POST["affectedto"]);
- if ($_POST["affectedto"])
+ if ($_POST["affectedto"])
{
$usertodo->fetch();
}
$actioncomm->usertodo = $usertodo;
$userdone=new User($db,$_POST["doneby"]);
- if ($_POST["doneby"])
+ if ($_POST["doneby"])
{
$userdone->fetch();
}
@@ -387,16 +387,16 @@ if ($_POST["action"] == 'update')
$db->rollback();
}
}
- }
+ }
- if ($result < 0)
- {
+ if ($result < 0)
+ {
$langs->load("errors");
- $mesg=''.$langs->trans($actioncomm->error).'
';
- $_GET["id"]=$_POST["id"];
- }
- else
- {
+ $mesg=''.$langs->trans($actioncomm->error).'
';
+ $_GET["id"]=$_POST["id"];
+ }
+ else
+ {
if (! empty($_POST["from"]))
{
header("Location: ".$_POST["from"]);
@@ -406,7 +406,7 @@ if ($_POST["action"] == 'update')
{
$_GET["id"]=$_REQUEST["id"];
}
- }
+ }
}
@@ -436,7 +436,7 @@ if ($_GET["action"] == 'create')
print '