diff --git a/htdocs/comm/action/indexactions.php b/htdocs/comm/action/indexactions.php index 327322eeffae0fe62868de06fa49a82206c6a6d7..e7ad3177ad6b9daa5441367262a64005bebe49e9 100644 --- a/htdocs/comm/action/indexactions.php +++ b/htdocs/comm/action/indexactions.php @@ -40,7 +40,7 @@ if ($page == -1) { $page = 0 ; } $limit = $conf->liste_limit; $offset = $limit * $page ; if (! $sortorder) $sortorder="DESC"; -if (! $sortfield) $sortfield="a.datea"; +if (! $sortfield) $sortfield="a.datep"; // S�curit� acc�s client if ($user->societe_id > 0) diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index c013c861be3e619a36663efdb375dd5566fc9e24..03852e277ea6b2e7b38c26872a6f4254ad6f5acf 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -72,7 +72,7 @@ if (! $sortfield) { $sortfield="a.percent"; if ($status == 'todo') $sortfield="a.datep"; - if ($status == 'done') $sortfield="a.datea2"; + if ($status == 'done') $sortfield="a.datep2"; } diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index bf3d520b33241886ca81f7d767e7c8f15601bab8..66834fe1fdd189ad79731b2d76d92bd245169aa0 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -36,7 +36,7 @@ if ($page == -1) { $page = 0 ; } $limit = $conf->liste_limit; $offset = $limit * $page ; if (! $sortorder) $sortorder="DESC"; -if (! $sortfield) $sortfield="a.datea"; +if (! $sortfield) $sortfield="a.datep"; // S�curit� acc�s client if ($user->societe_id > 0) diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 4cd0c4d641feb880c7d746a1b3364021af1613cc..29088537e480b8320746b52ea3ccd93bf98c3870 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -637,7 +637,7 @@ if ($_GET["id"] && $_GET["action"] != 'edit') $numaction = 0 ; // Recherche histo sur actioncomm - $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, a.note, a.percent as percentage,"; + $sql = "SELECT a.id, ".$db->pdate("a.datep")." as da, a.note, a.percent as percentage,"; $sql.= " c.code as acode, c.libelle,"; $sql.= " u.rowid as user_id, u.login"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; diff --git a/htdocs/lib/agenda.lib.php b/htdocs/lib/agenda.lib.php index f82d16fafcd7826e37afa71f189171d2ece8b1a5..e752ba083f6ef2d3dc4e53ea6b1d68f1ee3a69cb 100644 --- a/htdocs/lib/agenda.lib.php +++ b/htdocs/lib/agenda.lib.php @@ -1,223 +1,223 @@ -<?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=5) -{ - global $langs, $conf, $user, $db, $bc, $socid; - - include_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php'); - include_once(DOL_DOCUMENT_ROOT.'/client.class.php'); - - $sql = "SELECT a.id, a.label, ".$db->pdate("a.datep")." as dp, a.fk_user_author, a.percent,"; - $sql.= " c.code, c.libelle,"; - $sql.= " s.nom as sname, s.rowid, s.client"; - if (!$user->rights->societe->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->societe->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->societe->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"; - $sql .= $db->plimit($max, 0); - - $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="3">'.$langs->trans("LastActionsToDo",$max).'</td>'; - print '<td colspan="2" align="right"><a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?status=todo">'.$langs->trans("FullList").'</a>'; - print '</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" alig="right">'.dolibarr_print_date($obj->dp,'day').' '; - $late=0; - if ($obj->percent == 0 && $obj->dp && date("U",$obj->dp) < time()) $late=1; - if ($obj->percent == 0 && ! $obj->dp && $obj->dp2 && date("U",$obj->dp) < time()) $late=1; - if ($obj->percent > 0 && $obj->percent < 100 && $obj->dp2 && date("U",$obj->dp2) < time()) $late=1; - if ($obj->percent > 0 && $obj->percent < 100 && ! $obj->dp2 && $obj->dp && date("U",$obj->dp) < time()) $late=1; - if ($late) 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++; - } - 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=5) -{ - global $langs, $conf, $user, $db, $bc, $socid; - - $sql = "SELECT a.id, a.percent, ".$db->pdate("a.datea")." as da, ".$db->pdate("a.datea2")." as da2, a.fk_user_author, a.label,"; - $sql.= " c.code, c.libelle,"; - $sql.= " s.rowid, s.nom as sname, s.client"; - if (!$user->rights->societe->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->societe->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->societe->client->voir && !$socid) //restriction - { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - } - $sql .= " ORDER BY a.datea2 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="3">'.$langs->trans("LastDoneTasks",$max).'</td>'; - print '<td colspan="2" align="right"><a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?status=done">'.$langs->trans("FullList").'</a>'; - print '</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]>"; - - $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,'',24).'</td>'; - - // Date - print '<td width="100" align="right">'.dolibarr_print_date($obj->da2,'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); - } -} - - -/** - \brief Define head array for tabs of agenda setup pages - \return Array of head - \version $Id$ -*/ -function agenda_prepare_head() -{ - global $langs, $conf, $user; - $h = 0; - $head = array(); - - $head[$h][0] = DOL_URL_ROOT."/admin/agenda.php"; - $head[$h][1] = $langs->trans("AutoActions"); - $head[$h][2] = 'autoactions'; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/admin/agenda_xcal.php"; - $head[$h][1] = $langs->trans("Other"); - $head[$h][2] = 'xcal'; - $h++; - - return $head; -} - +<?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=5) +{ + global $langs, $conf, $user, $db, $bc, $socid; + + include_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php'); + include_once(DOL_DOCUMENT_ROOT.'/client.class.php'); + + $sql = "SELECT a.id, a.label, ".$db->pdate("a.datep")." as dp, a.fk_user_author, a.percent,"; + $sql.= " c.code, c.libelle,"; + $sql.= " s.nom as sname, s.rowid, s.client"; + if (!$user->rights->societe->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->societe->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->societe->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"; + $sql .= $db->plimit($max, 0); + + $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="3">'.$langs->trans("LastActionsToDo",$max).'</td>'; + print '<td colspan="2" align="right"><a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?status=todo">'.$langs->trans("FullList").'</a>'; + print '</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" alig="right">'.dolibarr_print_date($obj->dp,'day').' '; + $late=0; + if ($obj->percent == 0 && $obj->dp && date("U",$obj->dp) < time()) $late=1; + if ($obj->percent == 0 && ! $obj->dp && $obj->dp2 && date("U",$obj->dp) < time()) $late=1; + if ($obj->percent > 0 && $obj->percent < 100 && $obj->dp2 && date("U",$obj->dp2) < time()) $late=1; + if ($obj->percent > 0 && $obj->percent < 100 && ! $obj->dp2 && $obj->dp && date("U",$obj->dp) < time()) $late=1; + if ($late) 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++; + } + 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=5) +{ + global $langs, $conf, $user, $db, $bc, $socid; + + $sql = "SELECT a.id, a.percent, ".$db->pdate("a.datep")." as da, ".$db->pdate("a.datep2")." as da2, a.fk_user_author, a.label,"; + $sql.= " c.code, c.libelle,"; + $sql.= " s.rowid, s.nom as sname, s.client"; + if (!$user->rights->societe->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->societe->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->societe->client->voir && !$socid) //restriction + { + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + } + $sql .= " ORDER BY a.datep2 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="3">'.$langs->trans("LastDoneTasks",$max).'</td>'; + print '<td colspan="2" align="right"><a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?status=done">'.$langs->trans("FullList").'</a>'; + print '</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]>"; + + $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,'',24).'</td>'; + + // Date + print '<td width="100" align="right">'.dolibarr_print_date($obj->da2,'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); + } +} + + +/** + \brief Define head array for tabs of agenda setup pages + \return Array of head + \version $Id$ +*/ +function agenda_prepare_head() +{ + global $langs, $conf, $user; + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT."/admin/agenda.php"; + $head[$h][1] = $langs->trans("AutoActions"); + $head[$h][2] = 'autoactions'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/admin/agenda_xcal.php"; + $head[$h][1] = $langs->trans("Other"); + $head[$h][2] = 'xcal'; + $h++; + + return $head; +} + ?> \ No newline at end of file diff --git a/htdocs/telephonie/client/facture.php b/htdocs/telephonie/client/facture.php index b00188ea9c1ffe1300d83b06efb2c45c40260b32..f135002bfeb104cdd7639b36c4edbdb9156bfa20 100644 --- a/htdocs/telephonie/client/facture.php +++ b/htdocs/telephonie/client/facture.php @@ -587,7 +587,7 @@ if ($_GET["facid"] > 0) /* * Liste des actions propres � la facture */ - $sql = "SELECT id, ".$db->pdate("a.datea")." as da, a.label, a.note"; + $sql = "SELECT id, ".$db->pdate("a.datep")." as da, a.label, a.note"; $sql .= ", u.login"; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."user as u "; $sql .= " WHERE a.fk_user_author = u.rowid ";