';
@@ -282,156 +280,16 @@ print '';
/*
- * 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 '';
- print '| '.$langs->trans("ActionsToDo").' | ';
- $var = true;
- $i = 0;
-
- $staticaction=new ActionComm($db);
- $customerstatic=new Client($db);
-
- while ($i < $num)
- {
- $obj = $db->fetch_object($resql);
- $var=!$var;
-
- print "";
-
- $staticaction->code=$obj->code;
- $staticaction->libelle=$obj->libelle;
- $staticaction->id=$obj->id;
- print '| '.$staticaction->getNomUrl(1,12).' | ';
-
- print ''.dolibarr_trunc($obj->label,24).' | ';
-
- $customerstatic->id=$obj->rowid;
- $customerstatic->nom=$obj->sname;
- $customerstatic->client=$obj->client;
- print ''.$customerstatic->getNomUrl(1,'',16).' | ';
-
- // Date
- print ''.dolibarr_print_date($obj->dp).' ';
- if (date("U",$obj->dp) < time())
- {
- print img_warning($langs->trans("Late"));
- }
- print " | ";
-
- // Statut
- print "".$staticaction->LibStatut($obj->percent,3)." | \n";
-
- print " \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 " ";
- }
- $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 ' ";
-
- $db->free($resql);
-}
-else
-{
- dolibarr_print_error($db);
-}
+show_array_last_actions_done($max);
/*
diff --git a/htdocs/includes/menus/barre_left/eldy_backoffice.php b/htdocs/includes/menus/barre_left/eldy_backoffice.php
index 6f4ec38d472..306dc864d39 100644
--- a/htdocs/includes/menus/barre_left/eldy_backoffice.php
+++ b/htdocs/includes/menus/barre_left/eldy_backoffice.php
@@ -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);
}
}
diff --git a/htdocs/includes/menus/barre_left/eldy_frontoffice.php b/htdocs/includes/menus/barre_left/eldy_frontoffice.php
index 4b98b4edc47..61ad5c81bf4 100644
--- a/htdocs/includes/menus/barre_left/eldy_frontoffice.php
+++ b/htdocs/includes/menus/barre_left/eldy_frontoffice.php
@@ -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);
diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang
index 3883b11b28e..e1a30b1fc33 100644
--- a/htdocs/langs/en_US/agenda.lang
+++ b/htdocs/langs/en_US/agenda.lang
@@ -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
\ No newline at end of file
+DoneBy=Done by
+Events=Events
+SearchAnAction=Search an action
\ No newline at end of file
diff --git a/htdocs/langs/en_US/commercial.lang b/htdocs/langs/en_US/commercial.lang
index d42d60db984..011a10803b1 100644
--- a/htdocs/langs/en_US/commercial.lang
+++ b/htdocs/langs/en_US/commercial.lang
@@ -2,6 +2,7 @@
Commercial=Commercial
CommercialArea=Commercial area
CommercialCard=Commercial card
+CustomerArea=Customers area
Customer=Customer
Customers=Customers
Prospect=Prospect
diff --git a/htdocs/langs/fr_FR/agenda.lang b/htdocs/langs/fr_FR/agenda.lang
index c1c32aa3c79..5e07802bcee 100644
--- a/htdocs/langs/fr_FR/agenda.lang
+++ b/htdocs/langs/fr_FR/agenda.lang
@@ -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
\ No newline at end of file
+DoneBy=Réalisé par
+Events=Evênements
+SearchAnAction=Rechercher une action
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/commercial.lang b/htdocs/langs/fr_FR/commercial.lang
index 46c87589272..a36eb4dffd1 100644
--- a/htdocs/langs/fr_FR/commercial.lang
+++ b/htdocs/langs/fr_FR/commercial.lang
@@ -2,6 +2,7 @@
Commercial=Commercial
CommercialArea=Espace commercial
CommercialCard=Fiche commerciale
+CustomerArea=Espace clients
Customer=Client
Customers=Clients
Prospect=Prospect
diff --git a/htdocs/lib/agenda.lib.php b/htdocs/lib/agenda.lib.php
new file mode 100644
index 00000000000..c4a6f4b8efa
--- /dev/null
+++ b/htdocs/lib/agenda.lib.php
@@ -0,0 +1,188 @@
+
+ *
+ * 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 '';
+ print '| '.$langs->trans("ActionsToDo").' | ';
+ $var = true;
+ $i = 0;
+
+ $staticaction=new ActionComm($db);
+ $customerstatic=new Client($db);
+
+ while ($i < $num)
+ {
+ $obj = $db->fetch_object($resql);
+ $var=!$var;
+
+ print "";
+
+ $staticaction->code=$obj->code;
+ $staticaction->libelle=$obj->libelle;
+ $staticaction->id=$obj->id;
+ print '| '.$staticaction->getNomUrl(1,12).' | ';
+
+ print ''.dolibarr_trunc($obj->label,24).' | ';
+
+ $customerstatic->id=$obj->rowid;
+ $customerstatic->nom=$obj->sname;
+ $customerstatic->client=$obj->client;
+ print ''.$customerstatic->getNomUrl(1,'',16).' | ';
+
+ // Date
+ print ''.dolibarr_print_date($obj->dp).' ';
+ if (date("U",$obj->dp) < time())
+ {
+ print img_warning($langs->trans("Late"));
+ }
+ print " | ";
+
+ // Statut
+ print "".$staticaction->LibStatut($obj->percent,3)." | \n";
+
+ print " \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 " ";
+ }
+ $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 ' ";
+
+ $db->free($resql);
+ }
+ else
+ {
+ dolibarr_print_error($db);
+ }
+}
+
+?>
\ No newline at end of file
|