New: Add pages for agenda module
This commit is contained in:
parent
25169f16bc
commit
f670dca6fd
@ -282,10 +282,18 @@ class ActionComm
|
||||
*/
|
||||
function update($user)
|
||||
{
|
||||
$this->label=trim($this->label);
|
||||
// Clean parameters
|
||||
$this->label=trim($this->label);
|
||||
$this->note=trim($this->note);
|
||||
if ($this->percentage > 100) $this->percentage = 100;
|
||||
|
||||
// Check parameters
|
||||
if ($this->percentage == 0 && $this->userdone->id > 0)
|
||||
{
|
||||
$this->error="ErrorCantSaveADoneUserWithZeroPercentage";
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm ";
|
||||
$sql.= " SET percent='".$this->percentage."'";
|
||||
if ($this->label) $sql.= ", label = '".addslashes($this->label)."'";
|
||||
@ -295,8 +303,8 @@ class ActionComm
|
||||
if ($this->contact->id) $sql.= ", fk_contact =". $this->contact->id;
|
||||
$sql.= ", priority = '".$this->priority."'";
|
||||
$sql.= ", fk_user_mod = '".$user->id."'";
|
||||
$sql.= ", fk_user_action='".$this->usertodo->id."'";
|
||||
$sql.= ", fk_user_done='".$this->userdone->id."'";
|
||||
$sql.= ", fk_user_action=".($this->usertodo->id > 0?"'".$this->usertodo->id."'":"null");
|
||||
$sql.= ", fk_user_done=".($this->userdone->id > 0?"'".$this->userdone->id."'":"null");
|
||||
$sql.= " WHERE id=".$this->id;
|
||||
|
||||
dolibarr_syslog("ActionComm::update sql=".$sql);
|
||||
@ -307,6 +315,7 @@ class ActionComm
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("ActionComm::update ".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,8 +21,8 @@
|
||||
|
||||
/**
|
||||
\file htdocs/comm/action/fiche.php
|
||||
\ingroup commercial
|
||||
\brief Page de la fiche action
|
||||
\ingroup agenda
|
||||
\brief Page for action card
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
@ -258,13 +258,13 @@ if ($_POST["action"] == 'update')
|
||||
$actioncomm = new Actioncomm($db);
|
||||
$actioncomm->fetch($_POST["id"]);
|
||||
|
||||
$actioncomm->datep = @mktime($_POST["aphour"],
|
||||
$actioncomm->datep = dolibarr_mktime($_POST["aphour"],
|
||||
$_POST["apmin"],
|
||||
0,
|
||||
$_POST["apmonth"],
|
||||
$_POST["apday"],
|
||||
$_POST["apyear"]);
|
||||
$actioncomm->date = @mktime($_POST["adhour"],
|
||||
$actioncomm->date = dolibarr_mktime($_POST["adhour"],
|
||||
$_POST["admin"],
|
||||
0,
|
||||
$_POST["admonth"],
|
||||
@ -306,8 +306,15 @@ if ($_POST["action"] == 'update')
|
||||
}
|
||||
else
|
||||
{
|
||||
Header("Location: ".$_POST["from"]);
|
||||
exit;
|
||||
if (! empty($_POST["from"]))
|
||||
{
|
||||
header("Location: ".$_POST["from"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$_GET["id"]=$_REQUEST["id"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,7 +341,7 @@ if ($_GET["action"] == 'create')
|
||||
}
|
||||
|
||||
print '<form name="action" action="fiche.php" method="post">';
|
||||
print '<input type="hidden" name="from" value="'.($_REQUEST["from"] ? $_REQUEST["from"] : $_SERVER["HTTP_REFERER"]).'">';
|
||||
if (! empty($_REQUEST["backtopage"])) print '<input type="hidden" name="from" value="'.($_REQUEST["from"] ? $_REQUEST["from"] : $_SERVER["HTTP_REFERER"]).'">';
|
||||
print '<input type="hidden" name="action" value="add_action">';
|
||||
|
||||
/*
|
||||
@ -591,13 +598,13 @@ if ($_GET["id"])
|
||||
}
|
||||
|
||||
$act = new ActionComm($db);
|
||||
$act->fetch($_GET["id"]);
|
||||
$res=$act->societe->fetch($act->societe->id);
|
||||
|
||||
if ($act->author->id) $res=$act->author->fetch(); // Le parametre est le login, hors seul l'id est charge.
|
||||
if ($act->usermod->id) $res=$act->usermod->fetch();
|
||||
if ($act->usertodo->id) $res=$act->usertodo->fetch();
|
||||
if ($act->userdone->id) $res=$act->userdone->fetch();
|
||||
$result=$act->fetch($_GET["id"]);
|
||||
//print $result."ee".$act->userdone->id."ee";
|
||||
$result=$act->societe->fetch($act->societe->id);
|
||||
if ($act->author->id > 0) $res=$act->author->fetch(); // Le parametre est le login, hors seul l'id est charge.
|
||||
if ($act->usermod->id > 0) $res=$act->usermod->fetch();
|
||||
if ($act->usertodo->id > 0) $res=$act->usertodo->fetch();
|
||||
if ($act->userdone->id > 0) $res=$act->userdone->fetch();
|
||||
|
||||
$res=$act->contact->fetch($act->contact->id);
|
||||
|
||||
@ -635,8 +642,8 @@ if ($_GET["id"])
|
||||
// Fiche action en mode edition
|
||||
print '<form action="fiche.php" method="post">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$_GET["id"].'">';
|
||||
print '<input type="hidden" name="from" value="'.($_REQUEST["from"] ? $_REQUEST["from"] : $_SERVER["HTTP_REFERER"]).'">';
|
||||
print '<input type="hidden" name="id" value="'.$_REQUEST["id"].'">';
|
||||
if (! empty($_REQUEST["backtopage"])) print '<input type="hidden" name="from" value="'.($_REQUEST["from"] ? $_REQUEST["from"] : $_SERVER["HTTP_REFERER"]).'">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">'.$act->id.'</td></tr>';
|
||||
@ -749,6 +756,7 @@ if ($_GET["id"])
|
||||
|
||||
// Realise par
|
||||
print '<tr><td nowrap>'.$langs->trans("ActionDoneBy").'</td><td colspan="3">';
|
||||
print $act->userdone->id;
|
||||
if ($act->userdone->id) print $act->userdone->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Éric Seigne <erics@rycks.com>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -21,210 +20,58 @@
|
||||
|
||||
/**
|
||||
\file htdocs/comm/action/index.php
|
||||
\ingroup commercial
|
||||
\brief Page accueil des actions commerciales
|
||||
\ingroup agenda
|
||||
\brief Page accueil des rapports des actions
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
|
||||
require_once("./pre.inc.php");
|
||||
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"];
|
||||
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
||||
$page = isset($_GET["page"])?$_GET["page"]:$_POST["page"];
|
||||
|
||||
// Security check
|
||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'societe',$socid,'',1);
|
||||
|
||||
$page = $_GET["page"];
|
||||
$sortfield=$_GET["sortfield"];
|
||||
$sortorder=$_GET["sortorder"];
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="a.datep";
|
||||
if (! $sortfield) $sortfield="a.datea";
|
||||
|
||||
$status=isset($_GET["status"])?$_GET["status"]:$_POST["status"];
|
||||
// Sécurité accés client
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
if ($_GET["action"] == 'builddoc')
|
||||
{
|
||||
$cat = new CommActionRapport($db, $_GET["month"], $_GET["year"]);
|
||||
$result=$cat->generate($_GET["id"]);
|
||||
}
|
||||
|
||||
if ($action=='delete_action')
|
||||
{
|
||||
$actioncomm = new ActionComm($db);
|
||||
$actioncomm->fetch($actionid);
|
||||
$result=$actioncomm->delete();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Affichage liste
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
/*
|
||||
* Affichage liste des actions
|
||||
*
|
||||
*/
|
||||
|
||||
$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.= " 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,";
|
||||
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 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"];
|
||||
}
|
||||
if ($_GET["time"] == "today")
|
||||
{
|
||||
$sql .= " AND date_format(a.datep, '%d%m%Y') = ".strftime("%d%m%Y",time());
|
||||
}
|
||||
if ($socid)
|
||||
{
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
}
|
||||
if (!$user->rights->commercial->client->voir && !$socid) //restriction
|
||||
{
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
}
|
||||
if ($status == 'done') { $sql.= " AND a.percent = 100"; }
|
||||
if ($status == 'todo') { $sql.= " AND a.percent < 100"; }
|
||||
$sql .= " ORDER BY ".$sortfield." ".$sortorder;
|
||||
$sql .= $db->plimit( $limit + 1, $offset);
|
||||
|
||||
dolibarr_syslog("comm/action/index.php sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$actionstatic=new ActionComm($db);
|
||||
$societestatic=new Societe($db);
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
$title="DoneAndToDoActions";
|
||||
if ($status == 'done') $title="DoneActions";
|
||||
if ($status == 'todo') $title="ToDoActions";
|
||||
$param="&status=".$status;
|
||||
|
||||
if ($socid)
|
||||
{
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($socid);
|
||||
|
||||
print_barre_liste($langs->trans($title."For",$societe->nom), $page, "index.php",$param,$sortfield,$sortorder,'',$num);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_barre_liste($langs->trans($title), $page, "index.php",$param,$sortfield,$sortorder,'',$num);
|
||||
}
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("DatePlanShort"),$_SERVER["PHP_SELF"],"a.datep",$param,'','',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateRealShort"),$_SERVER["PHP_SELF"],"a.datea",$param,'','',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"acode",$param,"","",$sortfield,$sortorder);
|
||||
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("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 "</tr>\n";
|
||||
|
||||
$contactstatic = new Contact($db);
|
||||
|
||||
$var=true;
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td align="left" nowrap="nowrap">';
|
||||
print dolibarr_print_date($obj->dp,"dayhour");
|
||||
print '</td>';
|
||||
|
||||
print '<td align="left" nowrap="nowrap">';
|
||||
print dolibarr_print_date($obj->da,"dayhour");
|
||||
print '</td>';
|
||||
|
||||
// Action (type)
|
||||
print '<td>';
|
||||
$actionstatic->id=$obj->id;
|
||||
$actionstatic->code=$obj->acode;
|
||||
$actionstatic->libelle=$obj->libelle;
|
||||
print $actionstatic->getNomUrl(1,12);
|
||||
print '</td>';
|
||||
|
||||
// Titre
|
||||
print '<td>';
|
||||
print $obj->label;
|
||||
print '</td>';
|
||||
|
||||
// Société
|
||||
print '<td>';
|
||||
$societestatic->id=$obj->socid;
|
||||
$societestatic->client=$obj->client;
|
||||
$societestatic->nom=$obj->societe;
|
||||
print $societestatic->getNomUrl(1,'',16);
|
||||
print '</td>';
|
||||
|
||||
// Contact
|
||||
print '<td>';
|
||||
if ($obj->fk_contact > 0)
|
||||
{
|
||||
$contactstatic->name=$obj->name;
|
||||
$contactstatic->firstname=$obj->firstname;
|
||||
$contactstatic->id=$obj->fk_contact;
|
||||
print $contactstatic->getNomUrl(1,'',16);
|
||||
}
|
||||
else
|
||||
{
|
||||
print " ";
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// User to do
|
||||
print '<td align="left">';
|
||||
if ($obj->useridtodo)
|
||||
{
|
||||
$userstatic=new User($db,$obj->useridtodo);
|
||||
$userstatic->id=$obj->useridtodo;
|
||||
$userstatic->login=$obj->logintodo;
|
||||
print $userstatic->getLoginUrl(1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
// User did
|
||||
print '<td align="left">';
|
||||
if ($obj->useriddone)
|
||||
{
|
||||
$userstatic=new User($db,$obj->useriddone);
|
||||
$userstatic->id=$obj->useriddone;
|
||||
$userstatic->login=$obj->logindone;
|
||||
print $userstatic->getLoginUrl(1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Status/Percent
|
||||
print '<td align="right" nowrap="nowrap">'.$actionstatic->LibStatut($obj->percent,5).'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$db->free($resql);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print $langs->trans("FeatureNotYetAvailable");
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
106
htdocs/comm/action/indexactions.php
Normal file
106
htdocs/comm/action/indexactions.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/comm/action/indexactions.php
|
||||
\ingroup agenda
|
||||
\brief Actions area
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/client.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/agenda.lib.php");
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("commercial");
|
||||
$langs->load("agenda");
|
||||
|
||||
$page = $_GET["page"];
|
||||
$sortfield=$_GET["sortfield"];
|
||||
$sortorder=$_GET["sortorder"];
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="a.datea";
|
||||
|
||||
// Sécurité accés client
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
if ($_GET["action"] == 'builddoc')
|
||||
{
|
||||
$cat = new CommActionRapport($db, $_GET["month"], $_GET["year"]);
|
||||
$result=$cat->generate($_GET["id"]);
|
||||
}
|
||||
|
||||
if ($action=='delete_action')
|
||||
{
|
||||
$actioncomm = new ActionComm($db);
|
||||
$actioncomm->fetch($actionid);
|
||||
$result=$actioncomm->delete();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Affichage liste
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
print_fiche_titre($langs->trans("ActionsArea"));
|
||||
|
||||
print '<table border="0" width="100%" class="notopnoleftnoright">';
|
||||
|
||||
print '<tr><td valign="top" width="30%" class="notopnoleft">';
|
||||
|
||||
// Search actions
|
||||
$var=false;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/action/listactions.php">';
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAnAction").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("Keyword").':</td><td><input type="text" class="flat" name="sf_ref" size="18"></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
print '</tr>';
|
||||
print "</form></table><br>\n";
|
||||
|
||||
|
||||
print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
|
||||
|
||||
show_array_actions_to_do(0);
|
||||
|
||||
show_array_last_actions_done(5);
|
||||
|
||||
print '</td></tr></table>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
233
htdocs/comm/action/listactions.php
Normal file
233
htdocs/comm/action/listactions.php
Normal file
@ -0,0 +1,233 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Éric Seigne <erics@rycks.com>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/comm/action/listactions.php
|
||||
\ingroup agenda
|
||||
\brief Page liste des actions commerciales
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once("./pre.inc.php");
|
||||
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"];
|
||||
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
||||
$page = isset($_GET["page"])?$_GET["page"]:$_POST["page"];
|
||||
|
||||
// Security check
|
||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'societe',$socid,'',1);
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="a.datep";
|
||||
|
||||
$status=isset($_GET["status"])?$_GET["status"]:$_POST["status"];
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
/*
|
||||
* Affichage liste des actions
|
||||
*
|
||||
*/
|
||||
|
||||
$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.= " 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,";
|
||||
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 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"];
|
||||
}
|
||||
if ($_GET["time"] == "today")
|
||||
{
|
||||
$sql .= " AND date_format(a.datep, '%d%m%Y') = ".strftime("%d%m%Y",time());
|
||||
}
|
||||
if ($socid)
|
||||
{
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
}
|
||||
if (!$user->rights->commercial->client->voir && !$socid) //restriction
|
||||
{
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
}
|
||||
if ($status == 'done') { $sql.= " AND a.percent = 100"; }
|
||||
if ($status == 'todo') { $sql.= " AND a.percent < 100"; }
|
||||
$sql .= " ORDER BY ".$sortfield." ".$sortorder;
|
||||
$sql .= $db->plimit( $limit + 1, $offset);
|
||||
|
||||
dolibarr_syslog("comm/action/index.php sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$actionstatic=new ActionComm($db);
|
||||
$societestatic=new Societe($db);
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
$title="DoneAndToDoActions";
|
||||
if ($status == 'done') $title="DoneActions";
|
||||
if ($status == 'todo') $title="ToDoActions";
|
||||
$param="&status=".$status;
|
||||
|
||||
if ($socid)
|
||||
{
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($socid);
|
||||
|
||||
print_barre_liste($langs->trans($title."For",$societe->nom), $page, "index.php",$param,$sortfield,$sortorder,'',$num);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_barre_liste($langs->trans($title), $page, "index.php",$param,$sortfield,$sortorder,'',$num);
|
||||
}
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"acode",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DatePlanShort"),$_SERVER["PHP_SELF"],"a.datep",$param,'','',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateRealShort"),$_SERVER["PHP_SELF"],"a.datea",$param,'','',$sortfield,$sortorder);
|
||||
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("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 "</tr>\n";
|
||||
|
||||
$contactstatic = new Contact($db);
|
||||
|
||||
$var=true;
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
// Action (type)
|
||||
print '<td>';
|
||||
$actionstatic->id=$obj->id;
|
||||
$actionstatic->code=$obj->acode;
|
||||
$actionstatic->libelle=$obj->libelle;
|
||||
print $actionstatic->getNomUrl(1,12);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="left" nowrap="nowrap">';
|
||||
print dolibarr_print_date($obj->dp,"dayhour");
|
||||
print '</td>';
|
||||
|
||||
print '<td align="left" nowrap="nowrap">';
|
||||
print dolibarr_print_date($obj->da,"dayhour");
|
||||
print '</td>';
|
||||
|
||||
// Titre
|
||||
print '<td>';
|
||||
print $obj->label;
|
||||
print '</td>';
|
||||
|
||||
// Société
|
||||
print '<td>';
|
||||
$societestatic->id=$obj->socid;
|
||||
$societestatic->client=$obj->client;
|
||||
$societestatic->nom=$obj->societe;
|
||||
print $societestatic->getNomUrl(1,'',16);
|
||||
print '</td>';
|
||||
|
||||
// Contact
|
||||
print '<td>';
|
||||
if ($obj->fk_contact > 0)
|
||||
{
|
||||
$contactstatic->name=$obj->name;
|
||||
$contactstatic->firstname=$obj->firstname;
|
||||
$contactstatic->id=$obj->fk_contact;
|
||||
print $contactstatic->getNomUrl(1,'',16);
|
||||
}
|
||||
else
|
||||
{
|
||||
print " ";
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// User to do
|
||||
print '<td align="left">';
|
||||
if ($obj->useridtodo)
|
||||
{
|
||||
$userstatic=new User($db,$obj->useridtodo);
|
||||
$userstatic->id=$obj->useridtodo;
|
||||
$userstatic->login=$obj->logintodo;
|
||||
print $userstatic->getLoginUrl(1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
// User did
|
||||
print '<td align="left">';
|
||||
if ($obj->useriddone)
|
||||
{
|
||||
$userstatic=new User($db,$obj->useriddone);
|
||||
$userstatic->id=$obj->useriddone;
|
||||
$userstatic->login=$obj->logindone;
|
||||
print $userstatic->getLoginUrl(1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Status/Percent
|
||||
print '<td align="right" nowrap="nowrap">'.$actionstatic->LibStatut($obj->percent,5).'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$db->free($resql);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
233
htdocs/comm/action/listevents.php
Normal file
233
htdocs/comm/action/listevents.php
Normal file
@ -0,0 +1,233 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/comm/action/listevents.php
|
||||
\ingroup agenda
|
||||
\brief Page liste des evenements
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once("./pre.inc.php");
|
||||
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"];
|
||||
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
||||
$page = isset($_GET["page"])?$_GET["page"]:$_POST["page"];
|
||||
|
||||
// Security check
|
||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'societe',$socid,'',1);
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="a.datep";
|
||||
|
||||
$status=isset($_GET["status"])?$_GET["status"]:$_POST["status"];
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
|
||||
print $langs->trans("FeatureNotYetAvailable");
|
||||
|
||||
/*
|
||||
* Affichage liste des actions
|
||||
*
|
||||
*/
|
||||
/*
|
||||
$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.= " 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,";
|
||||
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 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"];
|
||||
}
|
||||
if ($_GET["time"] == "today")
|
||||
{
|
||||
$sql .= " AND date_format(a.datep, '%d%m%Y') = ".strftime("%d%m%Y",time());
|
||||
}
|
||||
if ($socid)
|
||||
{
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
}
|
||||
if (!$user->rights->commercial->client->voir && !$socid) //restriction
|
||||
{
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
}
|
||||
if ($status == 'done') { $sql.= " AND a.percent = 100"; }
|
||||
if ($status == 'todo') { $sql.= " AND a.percent < 100"; }
|
||||
$sql .= " ORDER BY ".$sortfield." ".$sortorder;
|
||||
$sql .= $db->plimit( $limit + 1, $offset);
|
||||
|
||||
dolibarr_syslog("comm/action/index.php sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$actionstatic=new ActionComm($db);
|
||||
$societestatic=new Societe($db);
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
$title="DoneAndToDoActions";
|
||||
if ($status == 'done') $title="DoneActions";
|
||||
if ($status == 'todo') $title="ToDoActions";
|
||||
$param="&status=".$status;
|
||||
|
||||
if ($socid)
|
||||
{
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($socid);
|
||||
|
||||
print_barre_liste($langs->trans($title."For",$societe->nom), $page, "index.php",$param,$sortfield,$sortorder,'',$num);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_barre_liste($langs->trans($title), $page, "index.php",$param,$sortfield,$sortorder,'',$num);
|
||||
}
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"acode",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DatePlanShort"),$_SERVER["PHP_SELF"],"a.datep",$param,'','',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateRealShort"),$_SERVER["PHP_SELF"],"a.datea",$param,'','',$sortfield,$sortorder);
|
||||
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("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 "</tr>\n";
|
||||
|
||||
$contactstatic = new Contact($db);
|
||||
|
||||
$var=true;
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
// Action (type)
|
||||
print '<td>';
|
||||
$actionstatic->id=$obj->id;
|
||||
$actionstatic->code=$obj->acode;
|
||||
$actionstatic->libelle=$obj->libelle;
|
||||
print $actionstatic->getNomUrl(1,12);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="left" nowrap="nowrap">';
|
||||
print dolibarr_print_date($obj->dp,"dayhour");
|
||||
print '</td>';
|
||||
|
||||
print '<td align="left" nowrap="nowrap">';
|
||||
print dolibarr_print_date($obj->da,"dayhour");
|
||||
print '</td>';
|
||||
|
||||
// Titre
|
||||
print '<td>';
|
||||
print $obj->label;
|
||||
print '</td>';
|
||||
|
||||
// Société
|
||||
print '<td>';
|
||||
$societestatic->id=$obj->socid;
|
||||
$societestatic->client=$obj->client;
|
||||
$societestatic->nom=$obj->societe;
|
||||
print $societestatic->getNomUrl(1,'',16);
|
||||
print '</td>';
|
||||
|
||||
// Contact
|
||||
print '<td>';
|
||||
if ($obj->fk_contact > 0)
|
||||
{
|
||||
$contactstatic->name=$obj->name;
|
||||
$contactstatic->firstname=$obj->firstname;
|
||||
$contactstatic->id=$obj->fk_contact;
|
||||
print $contactstatic->getNomUrl(1,'',16);
|
||||
}
|
||||
else
|
||||
{
|
||||
print " ";
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// User to do
|
||||
print '<td align="left">';
|
||||
if ($obj->useridtodo)
|
||||
{
|
||||
$userstatic=new User($db,$obj->useridtodo);
|
||||
$userstatic->id=$obj->useridtodo;
|
||||
$userstatic->login=$obj->logintodo;
|
||||
print $userstatic->getLoginUrl(1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
// User did
|
||||
print '<td align="left">';
|
||||
if ($obj->useriddone)
|
||||
{
|
||||
$userstatic=new User($db,$obj->useriddone);
|
||||
$userstatic->id=$obj->useriddone;
|
||||
$userstatic->login=$obj->logindone;
|
||||
print $userstatic->getLoginUrl(1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Status/Percent
|
||||
print '<td align="right" nowrap="nowrap">'.$actionstatic->LibStatut($obj->percent,5).'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$db->free($resql);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
*/
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -15,15 +15,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/pre.inc.php
|
||||
\brief Fichier gestionnaire du menu de gauche de la zone actions
|
||||
\version $Revision$
|
||||
\ingroup agenda
|
||||
\brief Left menu handler for acions area
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("../../main.inc.php");
|
||||
@ -39,11 +37,24 @@ function llxHeader($head = "", $urlp = "")
|
||||
|
||||
|
||||
$langs->load("commercial");
|
||||
$menu->add(DOL_URL_ROOT."/comm/action/", $langs->trans("Actions"));
|
||||
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?time=today", $langs->trans("Today"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?status=todo", $langs->trans("MenuToDoActions"), 1);
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/action/rapport/index.php", $langs->trans("Reportings"));
|
||||
|
||||
|
||||
$langs->load("agenda");
|
||||
|
||||
// Calendar
|
||||
$menu->add(DOL_URL_ROOT."/comm/action/index.php?leftmenu=agenda", $langs->trans("Calendar"), 0, $user->rights->agenda->myactions->read);
|
||||
|
||||
// Actions
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/action/indexactions.php?leftmenu=agenda", $langs->trans("Actions"), 0, $user->rights->agenda->myactions->read);
|
||||
$menu->add_submenu(DOL_URL_ROOT."/societe.php?leftmenu=agenda", $langs->trans("NewAction"), 1, $user->rights->agenda->myactions->read);
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/action/listactions.php?leftmenu=agenda", $langs->trans("List"), 1, $user->rights->agenda->myactions->read);
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/action/listactions.php?leftmenu=agenda&status=todo", $langs->trans("MenuToDoActions"),2, $user->rights->agenda->myactions->read);
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/action/listactions.php?leftmenu=agenda&time=today", $langs->trans("Today"), 2, $user->rights->agenda->myactions->read);
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/action/rapport/index.php?leftmenu=agenda", $langs->trans("Reportings"), 1, $user->rights->agenda->myactions->read);
|
||||
|
||||
// Events
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/action/listevents.php?leftmenu=agenda", $langs->trans("Events"), 0, $user->rights->agenda->myactions->read);
|
||||
|
||||
|
||||
if ($conf->societe->enabled) {
|
||||
$langs->load("companies");
|
||||
@ -62,11 +73,6 @@ function llxHeader($head = "", $urlp = "")
|
||||
$menu->add(DOL_URL_ROOT."/comm/propal.php", $langs->trans("Prop"));
|
||||
}
|
||||
|
||||
if ($conf->projet->enabled) {
|
||||
$langs->load("projects");
|
||||
$menu->add(DOL_URL_ROOT."/projet/index.php", $langs->trans("Projects"));
|
||||
}
|
||||
|
||||
left_menu($menu->liste);
|
||||
}
|
||||
|
||||
|
||||
@ -15,15 +15,12 @@
|
||||
* 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/rapport/pre.inc.php
|
||||
\brief Fichier gestionnaire du menu de gauche de la zone rapport des actions
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("../../../main.inc.php");
|
||||
@ -39,11 +36,22 @@ function llxHeader($head = "", $urlp = "")
|
||||
|
||||
|
||||
$langs->load("commercial");
|
||||
$menu->add(DOL_URL_ROOT."/comm/action/", $langs->trans("Actions"));
|
||||
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?time=today", $langs->trans("Today"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?status=todo", $langs->trans("MenuToDoActions"), 1);
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/action/rapport/index.php", $langs->trans("Reportings"));
|
||||
$langs->load("agenda");
|
||||
|
||||
// Calendar
|
||||
$menu->add(DOL_URL_ROOT."/comm/action/index.php?leftmenu=agenda", $langs->trans("Calendar"), 0, $user->rights->agenda->myactions->read);
|
||||
|
||||
// Actions
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/action/indexactions.php?leftmenu=agenda", $langs->trans("Actions"), 0, $user->rights->agenda->myactions->read);
|
||||
$menu->add_submenu(DOL_URL_ROOT."/societe.php?leftmenu=agenda", $langs->trans("NewAction"), 1, $user->rights->agenda->myactions->read);
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/action/listactions.php?leftmenu=agenda", $langs->trans("List"), 1, $user->rights->agenda->myactions->read);
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/action/listactions.php?leftmenu=agenda&status=todo", $langs->trans("MenuToDoActions"),2, $user->rights->agenda->myactions->read);
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/action/listactions.php?leftmenu=agenda&time=today", $langs->trans("Today"), 2, $user->rights->agenda->myactions->read);
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/action/rapport/index.php?leftmenu=agenda", $langs->trans("Reportings"), 1, $user->rights->agenda->myactions->read);
|
||||
|
||||
// Events
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/action/listevents.php?leftmenu=agenda", $langs->trans("Events"), 0, $user->rights->agenda->myactions->read);
|
||||
|
||||
|
||||
if ($conf->societe->enabled) {
|
||||
$langs->load("companies");
|
||||
@ -61,11 +69,7 @@ function llxHeader($head = "", $urlp = "")
|
||||
$langs->load("propal");
|
||||
$menu->add(DOL_URL_ROOT."/comm/propal.php", $langs->trans("Prop"));
|
||||
}
|
||||
|
||||
if ($conf->projet->enabled) {
|
||||
$langs->load("projects");
|
||||
$menu->add(DOL_URL_ROOT."/projet/index.php", $langs->trans("Projects"));
|
||||
}
|
||||
|
||||
|
||||
left_menu($menu->liste);
|
||||
}
|
||||
|
||||
@ -15,16 +15,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/index.php
|
||||
\ingroup commercial
|
||||
\brief Page acceuil de la zone commercial
|
||||
\version $Revision$
|
||||
\brief Page acceuil de la zone commercial cliente
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
@ -33,6 +30,7 @@ require_once(DOL_DOCUMENT_ROOT."/client.class.php");
|
||||
if ($conf->contrat->enabled) require_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php");
|
||||
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/agenda.lib.php");
|
||||
|
||||
if (!$user->rights->commercial->main->lire)
|
||||
accessforbidden();
|
||||
@ -90,7 +88,7 @@ $formfile = new FormFile($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
print_fiche_titre($langs->trans("CommercialArea"));
|
||||
print_fiche_titre($langs->trans("CustomerArea"));
|
||||
|
||||
print '<table border="0" width="100%" class="notopnoleftnoright">';
|
||||
|
||||
@ -282,156 +280,16 @@ print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
|
||||
|
||||
|
||||
/*
|
||||
* Actions commerciales a faire
|
||||
* Actions to do
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT a.id, a.label, ".$db->pdate("a.datep")." as dp, a.fk_user_author,";
|
||||
$sql.= " c.code, c.libelle,";
|
||||
$sql.= " s.nom as sname, s.rowid, s.client";
|
||||
if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".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.= " WHERE c.id=a.fk_action AND a.percent < 100 AND s.rowid = a.fk_soc";
|
||||
if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid)
|
||||
{
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
}
|
||||
$sql .= " ORDER BY a.datep DESC, a.id DESC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="9">'.$langs->trans("ActionsToDo").'</td></tr>';
|
||||
$var = true;
|
||||
$i = 0;
|
||||
|
||||
$staticaction=new ActionComm($db);
|
||||
$customerstatic=new Client($db);
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
$staticaction->code=$obj->code;
|
||||
$staticaction->libelle=$obj->libelle;
|
||||
$staticaction->id=$obj->id;
|
||||
print '<td>'.$staticaction->getNomUrl(1,12).'</td>';
|
||||
|
||||
print '<td>'.dolibarr_trunc($obj->label,24).'</td>';
|
||||
|
||||
$customerstatic->id=$obj->rowid;
|
||||
$customerstatic->nom=$obj->sname;
|
||||
$customerstatic->client=$obj->client;
|
||||
print '<td>'.$customerstatic->getNomUrl(1,'',16).'</td>';
|
||||
|
||||
// Date
|
||||
print '<td width="100">'.dolibarr_print_date($obj->dp).' ';
|
||||
if (date("U",$obj->dp) < time())
|
||||
{
|
||||
print img_warning($langs->trans("Late"));
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
// Statut
|
||||
print "<td align=\"center\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
// TODO Ajouter rappel pour "il y a des contrats à mettre en service"
|
||||
// TODO Ajouter rappel pour "il y a des contrats qui arrivent à expiration"
|
||||
print "</table><br>";
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
show_array_actions_to_do(0);
|
||||
|
||||
|
||||
/*
|
||||
* Dernières actions commerciales effectuées
|
||||
* Last actions
|
||||
*/
|
||||
|
||||
$sql = "SELECT a.id, a.percent, ".$db->pdate("a.datea")." as da, a.fk_user_author,";
|
||||
$sql.= " c.code, c.libelle,";
|
||||
$sql.= " s.rowid, s.nom as sname, s.client";
|
||||
if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".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 .= " WHERE c.id = a.fk_action AND a.percent >= 100 AND s.rowid = a.fk_soc";
|
||||
if ($socid)
|
||||
{
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
}
|
||||
if (!$user->rights->commercial->client->voir && !$socid) //restriction
|
||||
{
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
}
|
||||
$sql .= " ORDER BY a.datea DESC";
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="5">'.$langs->trans("LastDoneTasks",$max).'</td></tr>';
|
||||
$var = true;
|
||||
$i = 0;
|
||||
|
||||
$staticaction=new ActionComm($db);
|
||||
$customerstatic=new Client($db);
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"action/fiche.php?id=$obj->id\">".img_object($langs->trans("ShowTask"),"task");
|
||||
$transcode=$langs->trans("Action".$obj->code);
|
||||
$libelle=($transcode!="Action".$obj->code?$transcode:$obj->libelle);
|
||||
print $libelle;
|
||||
print '</a></td>';
|
||||
|
||||
$customerstatic->id=$obj->rowid;
|
||||
$customerstatic->nom=$obj->sname;
|
||||
$customerstatic->client=$obj->client;
|
||||
print '<td>'.$customerstatic->getNomUrl(1,'',24).'</td>';
|
||||
|
||||
// Date
|
||||
print '<td width="100" align="right">'.dolibarr_print_date($obj->da,'day');
|
||||
print "</td>";
|
||||
|
||||
// Statut
|
||||
print "<td align=\"center\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
// TODO Ajouter rappel pour "il y a des contrats à mettre en service"
|
||||
// TODO Ajouter rappel pour "il y a des contrats qui arrivent à expiration"
|
||||
print "</table><br>";
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
show_array_last_actions_done($max);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -264,11 +264,15 @@ class MenuLeft {
|
||||
// Actions
|
||||
if ($conf->agenda->enabled)
|
||||
{
|
||||
$newmenu->add(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions", $langs->trans("Agenda"), 0, $user->rights->agenda->myactions->read);
|
||||
if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/societe.php?leftmenu=actions", $langs->trans("NewAction"), 1, $user->rights->agenda->myactions->read);
|
||||
if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&status=todo", $langs->trans("MenuToDoActions"), 1, $user->rights->agenda->myactions->read);
|
||||
if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&time=today", $langs->trans("Today"), 1, $user->rights->agenda->myactions->read);
|
||||
if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/rapport/index.php?leftmenu=actions", $langs->trans("Reportings"), 1, $user->rights->agenda->myactions->read);
|
||||
$langs->load("agenda");
|
||||
|
||||
// Actions
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/action/indexactions.php?leftmenu=agenda", $langs->trans("Actions"), 0, $user->rights->agenda->myactions->read);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/societe.php?leftmenu=agenda", $langs->trans("NewAction"), 1, $user->rights->agenda->myactions->read);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/action/listactions.php?leftmenu=agenda", $langs->trans("List"), 1, $user->rights->agenda->myactions->read);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/action/listactions.php?leftmenu=agenda&status=todo", $langs->trans("MenuToDoActions"),2, $user->rights->agenda->myactions->read);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/action/listactions.php?leftmenu=agenda&time=today", $langs->trans("Today"), 2, $user->rights->agenda->myactions->read);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/action/rapport/index.php?leftmenu=agenda", $langs->trans("Reportings"), 1, $user->rights->agenda->myactions->read);
|
||||
}
|
||||
|
||||
// Prospects
|
||||
@ -710,11 +714,21 @@ class MenuLeft {
|
||||
// Actions
|
||||
if ($conf->agenda->enabled)
|
||||
{
|
||||
$newmenu->add(DOL_URL_ROOT."/comm/action/index.php?leftmenu=agenda", $langs->trans("Agenda"), 0, $user->rights->agenda->myactions->read);
|
||||
$langs->load("agenda");
|
||||
|
||||
// Calendar
|
||||
$newmenu->add(DOL_URL_ROOT."/comm/action/index.php?leftmenu=agenda", $langs->trans("Calendar"), 0, $user->rights->agenda->myactions->read);
|
||||
|
||||
// Actions
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/action/indexactions.php?leftmenu=agenda", $langs->trans("Actions"), 0, $user->rights->agenda->myactions->read);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/societe.php?leftmenu=agenda", $langs->trans("NewAction"), 1, $user->rights->agenda->myactions->read);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=agenda&status=todo", $langs->trans("MenuToDoActions"), 1, $user->rights->agenda->myactions->read);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=agenda&time=today", $langs->trans("Today"), 1, $user->rights->agenda->myactions->read);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/action/listactions.php?leftmenu=agenda", $langs->trans("List"), 1, $user->rights->agenda->myactions->read);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/action/listactions.php?leftmenu=agenda&status=todo", $langs->trans("MenuToDoActions"),2, $user->rights->agenda->myactions->read);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/action/listactions.php?leftmenu=agenda&time=today", $langs->trans("Today"), 2, $user->rights->agenda->myactions->read);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/action/rapport/index.php?leftmenu=agenda", $langs->trans("Reportings"), 1, $user->rights->agenda->myactions->read);
|
||||
|
||||
// Events
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/action/listevents.php?leftmenu=agenda", $langs->trans("Events"), 0, $user->rights->agenda->myactions->read);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -243,16 +243,19 @@ class MenuLeft {
|
||||
$langs->load("companies");
|
||||
|
||||
// Actions
|
||||
/*
|
||||
if ($conf->agenda->enabled)
|
||||
{
|
||||
$newmenu->add(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions", $langs->trans("Agenda"), 0, $user->rights->agenda->myactions->read);
|
||||
if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/societe.php?leftmenu=actions", $langs->trans("NewAction"), 1, $user->rights->agenda->myactions->read);
|
||||
if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&status=todo", $langs->trans("MenuToDoActions"), 1, $user->rights->agenda->myactions->read);
|
||||
if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&time=today", $langs->trans("Today"), 1, $user->rights->agenda->myactions->read);
|
||||
if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/rapport/index.php?leftmenu=actions", $langs->trans("Reportings"), 1, $user->rights->agenda->myactions->read);
|
||||
$langs->load("agenda");
|
||||
|
||||
// Actions
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/action/indexactions.php?leftmenu=agenda", $langs->trans("Actions"), 0, $user->rights->agenda->myactions->read);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/societe.php?leftmenu=agenda", $langs->trans("NewAction"), 1, $user->rights->agenda->myactions->read);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/action/listactions.php?leftmenu=agenda", $langs->trans("List"), 1, $user->rights->agenda->myactions->read);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/action/listactions.php?leftmenu=agenda&status=todo", $langs->trans("MenuToDoActions"),2, $user->rights->agenda->myactions->read);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/action/listactions.php?leftmenu=agenda&time=today", $langs->trans("Today"), 2, $user->rights->agenda->myactions->read);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/action/rapport/index.php?leftmenu=agenda", $langs->trans("Reportings"), 1, $user->rights->agenda->myactions->read);
|
||||
}
|
||||
*/
|
||||
|
||||
// Prospects
|
||||
/*
|
||||
$newmenu->add(DOL_URL_ROOT."/comm/prospect/index.php?leftmenu=prospects", $langs->trans("Prospects"), 0, $user->rights->societe->lire);
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
# Dolibarr language file - en_US - agenda
|
||||
ActionsArea=Actions area
|
||||
Agenda=Agenda
|
||||
Agendas=Agendas
|
||||
Calendar=Calendar
|
||||
Calendars=Calendars
|
||||
AffectedTo=Affected to
|
||||
DoneBy=Done by
|
||||
DoneBy=Done by
|
||||
Events=Events
|
||||
SearchAnAction=Search an action
|
||||
@ -2,6 +2,7 @@
|
||||
Commercial=Commercial
|
||||
CommercialArea=Commercial area
|
||||
CommercialCard=Commercial card
|
||||
CustomerArea=Customers area
|
||||
Customer=Customer
|
||||
Customers=Customers
|
||||
Prospect=Prospect
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
# Dolibarr language file - fr_FR - agenda
|
||||
ActionsArea=Espaces actions
|
||||
Agenda=Agenda
|
||||
Agendas=Agendas
|
||||
Calendar=Calendrier
|
||||
Calendars=Calendriers
|
||||
AffectedTo=Affecté à
|
||||
DoneBy=Réalisé par
|
||||
DoneBy=Réalisé par
|
||||
Events=Evênements
|
||||
SearchAnAction=Rechercher une action
|
||||
@ -2,6 +2,7 @@
|
||||
Commercial=Commercial
|
||||
CommercialArea=Espace commercial
|
||||
CommercialCard=Fiche commerciale
|
||||
CustomerArea=Espace clients
|
||||
Customer=Client
|
||||
Customers=Clients
|
||||
Prospect=Prospect
|
||||
|
||||
188
htdocs/lib/agenda.lib.php
Normal file
188
htdocs/lib/agenda.lib.php
Normal file
@ -0,0 +1,188 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* 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.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/lib/agenda.lib.php
|
||||
\brief Ensemble de fonctions de base de dolibarr sous forme d'include
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
\brief Show actions to do array
|
||||
\param max Max nb of records
|
||||
*/
|
||||
function show_array_actions_to_do($max)
|
||||
{
|
||||
global $langs, $conf, $user, $db, $bc, $socid;
|
||||
|
||||
$sql = "SELECT a.id, a.label, ".$db->pdate("a.datep")." as dp, a.fk_user_author,";
|
||||
$sql.= " c.code, c.libelle,";
|
||||
$sql.= " s.nom as sname, s.rowid, s.client";
|
||||
if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".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.= " WHERE c.id=a.fk_action AND a.percent < 100 AND s.rowid = a.fk_soc";
|
||||
if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid)
|
||||
{
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
}
|
||||
$sql .= " ORDER BY a.datep DESC, a.id DESC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="9">'.$langs->trans("ActionsToDo").'</td></tr>';
|
||||
$var = true;
|
||||
$i = 0;
|
||||
|
||||
$staticaction=new ActionComm($db);
|
||||
$customerstatic=new Client($db);
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
$staticaction->code=$obj->code;
|
||||
$staticaction->libelle=$obj->libelle;
|
||||
$staticaction->id=$obj->id;
|
||||
print '<td>'.$staticaction->getNomUrl(1,12).'</td>';
|
||||
|
||||
print '<td>'.dolibarr_trunc($obj->label,24).'</td>';
|
||||
|
||||
$customerstatic->id=$obj->rowid;
|
||||
$customerstatic->nom=$obj->sname;
|
||||
$customerstatic->client=$obj->client;
|
||||
print '<td>'.$customerstatic->getNomUrl(1,'',16).'</td>';
|
||||
|
||||
// Date
|
||||
print '<td width="100">'.dolibarr_print_date($obj->dp).' ';
|
||||
if (date("U",$obj->dp) < time())
|
||||
{
|
||||
print img_warning($langs->trans("Late"));
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
// Statut
|
||||
print "<td align=\"center\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
// TODO Ajouter rappel pour "il y a des contrats à mettre en service"
|
||||
// TODO Ajouter rappel pour "il y a des contrats qui arrivent à expiration"
|
||||
print "</table><br>";
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Show last actions array
|
||||
\param max Max nb of records
|
||||
*/
|
||||
function show_array_last_actions_done($max)
|
||||
{
|
||||
global $langs, $conf, $user, $db, $bc, $socid;
|
||||
|
||||
$sql = "SELECT a.id, a.percent, ".$db->pdate("a.datea")." as da, a.fk_user_author,";
|
||||
$sql.= " c.code, c.libelle,";
|
||||
$sql.= " s.rowid, s.nom as sname, s.client";
|
||||
if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".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 .= " WHERE c.id = a.fk_action AND a.percent >= 100 AND s.rowid = a.fk_soc";
|
||||
if ($socid)
|
||||
{
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
}
|
||||
if (!$user->rights->commercial->client->voir && !$socid) //restriction
|
||||
{
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
}
|
||||
$sql .= " ORDER BY a.datea DESC";
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="5">'.$langs->trans("LastDoneTasks",$max).'</td></tr>';
|
||||
$var = true;
|
||||
$i = 0;
|
||||
|
||||
$staticaction=new ActionComm($db);
|
||||
$customerstatic=new Societe($db);
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"".DOL_URL_ROOT."/comm/action/fiche.php?id=$obj->id\">".img_object($langs->trans("ShowTask"),"task");
|
||||
$transcode=$langs->trans("Action".$obj->code);
|
||||
$libelle=($transcode!="Action".$obj->code?$transcode:$obj->libelle);
|
||||
print $libelle;
|
||||
print '</a></td>';
|
||||
|
||||
$customerstatic->id=$obj->rowid;
|
||||
$customerstatic->nom=$obj->sname;
|
||||
$customerstatic->client=$obj->client;
|
||||
print '<td>'.$customerstatic->getNomUrl(1,'',24).'</td>';
|
||||
|
||||
// Date
|
||||
print '<td width="100" align="right">'.dolibarr_print_date($obj->da,'day');
|
||||
print "</td>";
|
||||
|
||||
// Statut
|
||||
print "<td align=\"center\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
// TODO Ajouter rappel pour "il y a des contrats à mettre en service"
|
||||
// TODO Ajouter rappel pour "il y a des contrats qui arrivent à expiration"
|
||||
print "</table><br>";
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user