Fix: Actions can has no status.

This commit is contained in:
Laurent Destailleur 2011-06-06 17:31:16 +00:00
parent a365a139ea
commit 842c87fc94
5 changed files with 18 additions and 10 deletions

View File

@ -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 (";

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify

View File

@ -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

View File

@ -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

View File

@ -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;