diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 6c7bf2939df..d175879237a 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -61,7 +61,8 @@ if ($_POST["action"] == 'add_action') if ($_POST['cancel']) { - header("Location: ".DOL_URL_ROOT.'/comm/fiche.php?socid='.$_POST['socid']); + if ($_POST['socid'] > 0) header("Location: ".DOL_URL_ROOT.'/comm/fiche.php?socid='.$_POST['socid']); + else header("Location: ".DOL_URL_ROOT.'/comm/action/indexactions.php'); exit; } diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index de9348292dc..227cd3bbe9c 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -47,8 +47,15 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'societe', $socid,''); -if (! $user->rights->agenda->actions->read) $filter="mine"; - +$canedit=1; +if (! $user->rights->agenda->myactions->read) access_forbidden(); +if (! $user->rights->agenda->allactions->read) +{ + $canedit=0; + $filtera="on"; + $filtert="on"; + $filterd="on"; +} if ($page == -1) { $page = 0 ; } $limit = $conf->liste_limit; $offset = $limit * $page ; @@ -99,6 +106,14 @@ if (!$user->rights->societe->client->voir && !$socid) //restriction } if ($status == 'done') { $sql.= " AND a.percent = 100"; } if ($status == 'todo') { $sql.= " AND a.percent < 100"; } +if ($filtera || $filtert || $filterd) +{ + $sql.= " AND ("; + if ($filtera) $sql.= " a.fk_user_author = ".$user->id; + if ($filtert) $sql.= ($filtera?" OR ":"")." a.fk_user_action = ".$user->id; + if ($filterd) $sql.= ($filtera||$filtert?" OR ":"")." a.fk_user_done = ".$user->id; + $sql.= ")"; +} $sql .= " ORDER BY ".$sortfield." ".$sortorder; $sql .= $db->plimit( $limit + 1, $offset); @@ -133,16 +148,17 @@ if ($resql) print '
| '; + print " |