From c2b0da6d6189cf6b63c80869a7f3b127f289e00f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Feb 2008 16:04:44 +0000 Subject: [PATCH] Add user affected to action Add user that did action Add user that modified action in log --- htdocs/comm/action/index.php | 49 +++++++++++++++++++++++++--------- htdocs/langs/en_US/agenda.lang | 4 ++- htdocs/langs/fr_FR/agenda.lang | 4 ++- 3 files changed, 42 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 0378949ddfe..bffdaef9b42 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -17,16 +17,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ */ /** \file htdocs/comm/action/index.php \ingroup commercial \brief Page accueil des actions commerciales - \version $Revision$ + \version $Id$ */ require_once("./pre.inc.php"); @@ -34,6 +31,7 @@ require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); $langs->load("companies"); +$langs->load("agenda"); $socid = isset($_GET["socid"])?$_GET["socid"]:$_POST["socid"]; $sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; @@ -66,14 +64,17 @@ llxHeader(); $sql = "SELECT s.nom as societe, s.rowid as socid, s.client,"; $sql.= " a.id,".$db->pdate("a.datep")." as dp, ".$db->pdate("a.datea")." as da, a.fk_contact, a.note, a.label, a.percent as percent,"; $sql.= " c.code as acode, c.libelle,"; -$sql.= " u.login, u.rowid as userid,"; +$sql.= " ut.login as logintodo, ut.rowid as useridtodo,"; +$sql.= " ud.login as logindone, ud.rowid as useriddone,"; $sql.= " sp.name, sp.firstname"; if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; -$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."user as u,"; +$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."societe as s,"; if (!$user->rights->commercial->client->voir && !$socid) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,"; $sql.= " ".MAIN_DB_PREFIX."actioncomm as a"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople sp ON a.fk_contact = sp.rowid"; -$sql.= " WHERE a.fk_soc = s.rowid AND c.id = a.fk_action AND a.fk_user_author = u.rowid"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ut ON a.fk_user_action = ut.rowid"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ud ON a.fk_user_done = ud.rowid"; +$sql.= " WHERE a.fk_soc = s.rowid AND c.id = a.fk_action"; if ($_GET["type"]) { $sql .= " AND c.id = ".$_GET["type"]; @@ -92,7 +93,7 @@ if (!$user->rights->commercial->client->voir && !$socid) //restriction } if ($status == 'done') { $sql.= " AND a.percent = 100"; } if ($status == 'todo') { $sql.= " AND a.percent < 100"; } -$sql .= " ORDER BY $sortfield $sortorder"; +$sql .= " ORDER BY ".$sortfield." ".$sortorder; $sql .= $db->plimit( $limit + 1, $offset); dolibarr_syslog("comm/action/index.php sql=".$sql); @@ -106,7 +107,7 @@ if ($resql) $title="DoneAndToDoActions"; if ($status == 'done') $title="DoneActions"; if ($status == 'todo') $title="ToDoActions"; - $param="&status=$status"; + $param="&status=".$status; if ($socid) { @@ -128,7 +129,8 @@ if ($resql) print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"],"u.login",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("AffectedTo"),$_SERVER["PHP_SELF"],"ut.login",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DoneBy"),$_SERVER["PHP_SELF"],"ud.login",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder); print "\n"; @@ -187,8 +189,29 @@ if ($resql) } print ''; - // Auteur - print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''; + // User to do + print ''; + if ($obj->useridtodo) + { + $userstatic=new User($db,$obj->useridtodo); + $userstatic->id=$obj->useridtodo; + $userstatic->login=$obj->logintodo; + print $userstatic->getLoginUrl(1); + } + else print ' '; + print ''; + + // User did + print ''; + if ($obj->useriddone) + { + $userstatic=new User($db,$obj->useriddone); + $userstatic->id=$obj->useriddone; + $userstatic->login=$obj->logindone; + print $userstatic->getLoginUrl(1); + } + else print ' '; + print ''; // Status/Percent print ''.$actionstatic->LibStatut($obj->percent,5).''; diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 56ed647ecca..3883b11b28e 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -2,4 +2,6 @@ Agenda=Agenda Agendas=Agendas Calendar=Calendar -Calendars=Calendars \ No newline at end of file +Calendars=Calendars +AffectedTo=Affected to +DoneBy=Done by \ No newline at end of file diff --git a/htdocs/langs/fr_FR/agenda.lang b/htdocs/langs/fr_FR/agenda.lang index e174275bb00..c1c32aa3c79 100644 --- a/htdocs/langs/fr_FR/agenda.lang +++ b/htdocs/langs/fr_FR/agenda.lang @@ -2,4 +2,6 @@ Agenda=Agenda Agendas=Agendas Calendar=Calendrier -Calendars=Calendriers \ No newline at end of file +Calendars=Calendriers +AffectedTo=Affecté à +DoneBy=Réalisé par \ No newline at end of file