From a6855be45bef0a272c5e496b88d7590286f55436 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Jul 2008 16:48:24 +0000 Subject: [PATCH] Fix: List of actions New: Add export for particular login --- htdocs/actioncomm.class.php | 50 ++++++++++++++++++++++------- htdocs/comm/action/agendaexport.php | 6 ++++ htdocs/comm/action/index.php | 4 +-- htdocs/comm/action/listactions.php | 20 ++++++++---- 4 files changed, 60 insertions(+), 20 deletions(-) diff --git a/htdocs/actioncomm.class.php b/htdocs/actioncomm.class.php index c3348bd1b33..21cdfcd0bed 100644 --- a/htdocs/actioncomm.class.php +++ b/htdocs/actioncomm.class.php @@ -68,7 +68,7 @@ class ActionComm /** * \brief Constructeur - * \param db Handler d'accès base de donnée + * \param db Handler d'acc�s base de donn�e */ function ActionComm($db) { @@ -88,7 +88,7 @@ class ActionComm * \brief Ajout d'une action en base * \param user auteur de la creation de l'action * \param notrigger 1 ne declenche pas les triggers, 0 sinon - * \return int id de l'action créée, < 0 si erreur + * \return int id de l'action cr��e, < 0 si erreur */ function add($user,$notrigger=0) { @@ -198,7 +198,7 @@ class ActionComm /** * \brief Charge l'objet action depuis la base - * \param id id de l'action a récupérer + * \param id id de l'action a r�cup�rer */ function fetch($id) { @@ -446,9 +446,9 @@ class ActionComm /** - * \brief Retourne le libellé du statut de la commande - * \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto - * \return string Libellé + * \brief Retourne le libell� du statut de la commande + * \param mode 0=libell� long, 1=libell� court, 2=Picto + Libell� court, 3=Picto, 4=Picto + Libell� long, 5=Libell� court + Picto + * \return string Libell� */ function getLibStatut($mode) { @@ -456,10 +456,10 @@ class ActionComm } /** - * \brief Renvoi le libellé d'un statut donné + * \brief Renvoi le libell� d'un statut donn� * \param percent Pourcentage avancement - * \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto - * \return string Libellé + * \param mode 0=libell� long, 1=libell� court, 2=Picto + Libell� court, 3=Picto, 4=Picto + Libell� long, 5=Libell� court + Picto + * \return string Libell� */ function LibStatut($percent,$mode) { @@ -506,7 +506,7 @@ class ActionComm /** * \brief Renvoie nom clicable (avec eventuellement le picto) * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul - * \param maxlength Nombre de caractères max dans libellé + * \param maxlength Nombre de caract�res max dans libell� * \param class Force style class on a link * \return string Chaine avec URL * \remarks Utilise $this->id, $this->code et $this->libelle @@ -596,10 +596,38 @@ class ActionComm $sql.= " c.id as type_id, c.code as type_code, c.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c"; $sql.= " WHERE a.fk_action=c.id"; - foreach($filters as $key => $value) + foreach ($filters as $key => $value) { if ($key == 'year') $sql.=' AND '; if ($key == 'idaction') $sql.=' AND a.id='.$value; + if ($key == 'login') + { + $userforfilter=new User($this->db); + $userforfilter->fetch($value); + $sql.= " AND ("; + $sql.= " a.fk_user_author = ".$userforfilter->id; + $sql.= " OR a.fk_user_action = ".$userforfilter->id; + $sql.= " OR a.fk_user_done = ".$userforfilter->id; + $sql.= ")"; + } + if ($key == 'logina') + { + $userforfilter=new User($this->db); + $userforfilter->fetch($value); + $sql.= " AND a.fk_user_author = ".$userforfilter->id; + } + if ($key == 'logint') + { + $userforfilter=new User($this->db); + $userforfilter->fetch($value); + $sql.= " AND a.fk_user_action = ".$userforfilter->id; + } + if ($key == 'logind') + { + $userforfilter=new User($this->db); + $userforfilter->fetch($value); + $sql.= " AND a.fk_user_done = ".$userforfilter->id; + } } $sql.= " ORDER by datec"; diff --git a/htdocs/comm/action/agendaexport.php b/htdocs/comm/action/agendaexport.php index 3152f628c60..34d07f223f9 100644 --- a/htdocs/comm/action/agendaexport.php +++ b/htdocs/comm/action/agendaexport.php @@ -19,6 +19,7 @@ /** \file htdocs/comm/action/agendaexport.php \ingroup agenda \brief Page export agenda + http://127.0.0.1/dolibarr/comm/action/agendaexport.php?format=rss&exportkey=cle&filter=mine \version $Id$ */ @@ -40,6 +41,11 @@ if (! empty($_GET["type"])) $type=$_GET["type"]; $filters=array(); if (! empty($_GET["year"])) $filters['year']=$_GET["year"]; if (! empty($_GET["idaction"])) $filters['idaction']=$_GET["idaction"]; +if (! empty($_GET["login"])) $filters['login']=$_GET["login"]; +if (! empty($_GET["logina"])) $filters['logina']=$_GET["logina"]; +if (! empty($_GET["logint"])) $filters['logint']=$_GET["logint"]; +if (! empty($_GET["logind"])) $filters['logind']=$_GET["logind"]; + // C'est un wrapper, donc header vierge function llxHeader() { print 'Export agenda cal'; } diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 2d28cb80b8b..f58adcba84b 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2003 Éric Seigne + * Copyright (C) 2003 Eric Seigne * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2008 Regis Houssin * @@ -213,8 +213,8 @@ if ($filtera > 0 || $filtert > 0 || $filterd > 0) if ($status == 'done') { $sql.= " AND a.percent = 100"; } if ($status == 'todo') { $sql.= " AND a.percent < 100"; } // \TODO Add filters on dates +//print $sql; -//echo "$sql
"; $actionarray=array(); $resql=$db->query($sql); if ($resql) diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index e51b4cf7d77..c3fda3701b5 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -110,14 +110,15 @@ $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->societe->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,"; +$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c,"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,"; $sql.= " ".MAIN_DB_PREFIX."actioncomm as a"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ua ON a.fk_user_author = ua.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"; +$sql.= " WHERE c.id = a.fk_action"; if ($_GET["type"]) { $sql .= " AND c.id = ".$_GET["type"]; @@ -146,6 +147,7 @@ if ($filtera > 0 || $filtert > 0 || $filterd > 0) } $sql .= " ORDER BY ".$sortfield." ".$sortorder; $sql .= $db->plimit( $limit + 1, $offset); +//print $sql; dolibarr_syslog("comm/action/listactions.php sql=".$sql); $resql=$db->query($sql); @@ -279,12 +281,16 @@ if ($resql) print dolibarr_print_date($obj->dp2,"day"); print ''; - // Société + // Third party print ''; - $societestatic->id=$obj->socid; - $societestatic->client=$obj->client; - $societestatic->nom=$obj->societe; - print $societestatic->getNomUrl(1,'',6); + if ($obj->socid) + { + $societestatic->id=$obj->socid; + $societestatic->client=$obj->client; + $societestatic->nom=$obj->societe; + print $societestatic->getNomUrl(1,'',6); + } + else print ' '; print ''; // Contact