diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 6e9d2505eaa..d502fd8757f 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -107,6 +107,8 @@ if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday")) * View */ +$now=dol_now(); + $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda'; llxHeader('',$langs->trans("Agenda"),$help_url); @@ -148,8 +150,8 @@ if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); 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; if ($_GET["type"]) $sql.= " AND c.id = ".$_GET["type"]; -if ($status == 'done') { $sql.= " AND a.percent = 100"; } -if ($status == 'todo') { $sql.= " AND a.percent < 100"; } +if ($status == 'done') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } +if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND percent < 100) OR (a.percent > -1 AND a.datep2 > '".$db->idate($now)."'))"; } if ($filtera > 0 || $filtert > 0 || $filterd > 0) { $sql.= " AND ("; diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 31cc3a32f2a..64bec3bfabc 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 203862bea7b..4012f20b722 100755 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -28,6 +28,7 @@ SuppliersOrdersToProcess=Supplier's orders to process StatusOrderCanceledShort=Canceled StatusOrderDraftShort=Draft StatusOrderValidatedShort=Validated +StatusOrderSentShort=Shipment in process StatusOrderOnProcessShort=Reception StatusOrderProcessedShort=Processed StatusOrderToBillShort=To bill diff --git a/htdocs/langs/fr_FR/orders.lang b/htdocs/langs/fr_FR/orders.lang index 948c5bc814d..24165d2d5ea 100755 --- a/htdocs/langs/fr_FR/orders.lang +++ b/htdocs/langs/fr_FR/orders.lang @@ -29,6 +29,7 @@ StatusOrderCanceledShort=Annulée StatusOrderDraftShort=Brouillon StatusOrderValidatedShort=Validée StatusOrderOnProcessShort=Réception +StatusOrderSentShort=Expédition en cours StatusOrderProcessedShort=Traitée StatusOrderToBillShort=À facturer StatusOrderApprovedShort=Approuvée diff --git a/htdocs/lib/agenda.lib.php b/htdocs/lib/agenda.lib.php index d13597f0cee..6f4638e38f8 100644 --- a/htdocs/lib/agenda.lib.php +++ b/htdocs/lib/agenda.lib.php @@ -119,13 +119,15 @@ function print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirt /** - * \brief Show actions to do array - * \param max Max nb of records + * 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; + $now=dol_now(); + include_once(DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'); include_once(DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'); @@ -137,7 +139,7 @@ function show_array_actions_to_do($max=5) $sql.= ", ".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"; - $sql.= " AND a.percent < 100"; + $sql.= " AND ((a.percent >= 0 AND percent < 100) OR (a.percent > -1 AND a.datep2 > '".$db->idate($now)."'))"; $sql.= " AND s.rowid = a.fk_soc"; $sql.= " AND s.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; @@ -212,13 +214,15 @@ function show_array_actions_to_do($max=5) /** - \brief Show last actions array - \param max Max nb of records -*/ + * 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; + $now=dol_now(); + $sql = "SELECT a.id, a.percent, a.datep as da, a.datep2 as da2, a.fk_user_author, a.label,"; $sql.= " c.code, c.libelle,"; $sql.= " s.rowid, s.nom as sname, s.client"; @@ -227,7 +231,7 @@ function show_array_last_actions_done($max=5) $sql.= ", ".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"; - $sql.= " AND a.percent >= 100"; + $sql.= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; $sql.= " AND s.rowid = a.fk_soc"; $sql.= " AND s.entity = ".$conf->entity; if ($socid) $sql.= " AND s.rowid = ".$socid;