FIX Confusion between expired and late
This commit is contained in:
parent
8d7f24a6d9
commit
4899d03ff8
@ -2108,7 +2108,7 @@ class Contrat extends CommonObject
|
|||||||
$this->from.= ", ".MAIN_DB_PREFIX."societe as s";
|
$this->from.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $this->from.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $this->from.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
|
|
||||||
if ($mode == 'inactives')
|
if ($mode == 'inactive')
|
||||||
{
|
{
|
||||||
$sql = "SELECT cd.rowid, cd.date_ouverture_prevue as datefin";
|
$sql = "SELECT cd.rowid, cd.date_ouverture_prevue as datefin";
|
||||||
$sql.= $this->from;
|
$sql.= $this->from;
|
||||||
@ -2123,25 +2123,44 @@ class Contrat extends CommonObject
|
|||||||
$sql.= " WHERE c.statut = 1";
|
$sql.= " WHERE c.statut = 1";
|
||||||
$sql.= " AND c.rowid = cd.fk_contrat";
|
$sql.= " AND c.rowid = cd.fk_contrat";
|
||||||
$sql.= " AND cd.statut = 4";
|
$sql.= " AND cd.statut = 4";
|
||||||
$sql.= " AND cd.date_fin_validite < '".$this->db->idate(time())."'";
|
$sql.= " AND cd.date_fin_validite < '".$this->db->idate(dol_now())."'";
|
||||||
|
}
|
||||||
|
elseif ($mode == 'active')
|
||||||
|
{
|
||||||
|
$sql = "SELECT cd.rowid, cd.date_fin_validite as datefin";
|
||||||
|
$sql.= $this->from;
|
||||||
|
$sql.= " WHERE c.statut = 1";
|
||||||
|
$sql.= " AND c.rowid = cd.fk_contrat";
|
||||||
|
$sql.= " AND cd.statut = 4";
|
||||||
|
//$datetouse = dol_now();
|
||||||
|
//$sql.= " AND cd.date_fin_validite < '".$this->db->idate($datetouse)."'";
|
||||||
}
|
}
|
||||||
$sql.= " AND c.fk_soc = s.rowid";
|
$sql.= " AND c.fk_soc = s.rowid";
|
||||||
$sql.= " AND c.entity = ".$conf->entity;
|
$sql.= " AND c.entity = ".$conf->entity;
|
||||||
if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id;
|
if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id;
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
|
|
||||||
|
var_dump($sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$langs->load("contracts");
|
$langs->load("contracts");
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
if ($mode == 'inactives') {
|
if ($mode == 'inactive') {
|
||||||
$warning_delay = $conf->contrat->services->inactifs->warning_delay;
|
$warning_delay = $conf->contrat->services->inactifs->warning_delay;
|
||||||
$label = $langs->trans("BoardNotActivatedServices");
|
$label = $langs->trans("BoardNotActivatedServices");
|
||||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=0';
|
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=0';
|
||||||
|
}
|
||||||
|
elseif ($mode == 'expired') {
|
||||||
|
$warning_delay = $conf->contrat->services->expires->warning_delay;
|
||||||
|
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired';
|
||||||
|
$label = $langs->trans("BoardExpiredServices");
|
||||||
} else {
|
} else {
|
||||||
$warning_delay = $conf->contrat->services->expires->warning_delay;
|
$warning_delay = $conf->contrat->services->expires->warning_delay;
|
||||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired';
|
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4';
|
||||||
|
//$url.= '&op2day='.$arraydatetouse['mday'].'&op2month='.$arraydatetouse['mon'].'&op2year='.$arraydatetouse['year'];
|
||||||
|
//if ($warning_delay >= 0) $url.='&filter=expired';
|
||||||
$label = $langs->trans("BoardRunningServices");
|
$label = $langs->trans("BoardRunningServices");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -432,9 +432,9 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
|
|||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||||
$board=new Contrat($db);
|
$board=new Contrat($db);
|
||||||
$dashboardlines[] = $board->load_board($user,"inactives");
|
$dashboardlines[] = $board->load_board($user, "inactive");
|
||||||
// Number of active services (expired)
|
// Number of active services (expired)
|
||||||
$dashboardlines[] = $board->load_board($user,"expired");
|
$dashboardlines[] = $board->load_board($user, "active");
|
||||||
}
|
}
|
||||||
// Number of invoices customers (has paid)
|
// Number of invoices customers (has paid)
|
||||||
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||||
|
|||||||
@ -64,7 +64,8 @@ DateStartRealShort=Real start date
|
|||||||
DateEndReal=Real end date
|
DateEndReal=Real end date
|
||||||
DateEndRealShort=Real end date
|
DateEndRealShort=Real end date
|
||||||
CloseService=Close service
|
CloseService=Close service
|
||||||
BoardRunningServices=Expired running services
|
BoardRunningServices=Services running
|
||||||
|
BoardExpiredServices=Services expired
|
||||||
ServiceStatus=Status of service
|
ServiceStatus=Status of service
|
||||||
DraftContracts=Drafts contracts
|
DraftContracts=Drafts contracts
|
||||||
CloseRefusedBecauseOneServiceActive=Contract can't be closed as there is at least one open service on it
|
CloseRefusedBecauseOneServiceActive=Contract can't be closed as there is at least one open service on it
|
||||||
|
|||||||
@ -456,7 +456,7 @@ Duration=Durée
|
|||||||
TotalDuration=Durée totale
|
TotalDuration=Durée totale
|
||||||
Summary=Résumé
|
Summary=Résumé
|
||||||
DolibarrStateBoard=Statistiques de la base
|
DolibarrStateBoard=Statistiques de la base
|
||||||
DolibarrWorkBoard=Éléments en attente
|
DolibarrWorkBoard=Tableau de bord des éléments ouverts
|
||||||
NoOpenedElementToProcess=Aucun élément ouvert à traiter
|
NoOpenedElementToProcess=Aucun élément ouvert à traiter
|
||||||
Available=Disponible
|
Available=Disponible
|
||||||
NotYetAvailable=Pas encore disponible
|
NotYetAvailable=Pas encore disponible
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user