Fix: List of actions
New: Add export for particular login
This commit is contained in:
parent
d4a85a6625
commit
a6855be45b
@ -68,7 +68,7 @@ class ActionComm
|
||||
|
||||
/**
|
||||
* \brief Constructeur
|
||||
* \param db Handler d'accès base de donnée
|
||||
* \param db Handler d'acc<EFBFBD>s base de donn<EFBFBD>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<EFBFBD><EFBFBD>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<EFBFBD>cup<EFBFBD>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<EFBFBD> du statut de la commande
|
||||
* \param mode 0=libell<EFBFBD> long, 1=libell<EFBFBD> court, 2=Picto + Libell<EFBFBD> court, 3=Picto, 4=Picto + Libell<EFBFBD> long, 5=Libell<EFBFBD> court + Picto
|
||||
* \return string Libell<EFBFBD>
|
||||
*/
|
||||
function getLibStatut($mode)
|
||||
{
|
||||
@ -456,10 +456,10 @@ class ActionComm
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi le libellé d'un statut donné
|
||||
* \brief Renvoi le libell<EFBFBD> d'un statut donn<EFBFBD>
|
||||
* \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<EFBFBD> long, 1=libell<EFBFBD> court, 2=Picto + Libell<EFBFBD> court, 3=Picto, 4=Picto + Libell<EFBFBD> long, 5=Libell<EFBFBD> court + Picto
|
||||
* \return string Libell<EFBFBD>
|
||||
*/
|
||||
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<EFBFBD>res max dans libell<EFBFBD>
|
||||
* \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";
|
||||
|
||||
|
||||
@ -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 '<html><title>Export agenda cal</title><body>'; }
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Éric Seigne <erics@rycks.com>
|
||||
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
@ -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<br>";
|
||||
$actionarray=array();
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -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 '</td>';
|
||||
|
||||
// Société
|
||||
// Third party
|
||||
print '<td>';
|
||||
$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 '</td>';
|
||||
|
||||
// Contact
|
||||
|
||||
Loading…
Reference in New Issue
Block a user