diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 5bfdd36a728..dc18a2c85e7 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -1,7 +1,7 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * * 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 @@ -417,6 +417,8 @@ if ($user->rights->adherent->cotisation->creer && $_POST["action"] == 'cotisatio $html = new Form($db); +$now=dol_now(); + llxHeader('',$langs->trans("Subscriptions"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); if ($rowid) @@ -466,15 +468,8 @@ if ($rowid) print ''.$langs->trans("SubscriptionEndDate").''; if ($adh->datefin) { - if ($adh->datefin < time()) - { - print dol_print_date($adh->datefin,'day'); - if ($adh->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie - } - else - { - print dol_print_date($adh->datefin,'day'); - } + print dol_print_date($adh->datefin,'day'); + if ($adh->datefin < ($now - $conf->adherent->cotisation->warning_delay) && $adh->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie } else { diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 14061536a6c..bff1fe94d4a 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1870,7 +1870,7 @@ class Adherent extends CommonObject { global $conf; - $now=gmmktime(); + $now=dol_now(); if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe @@ -1880,6 +1880,7 @@ class Adherent extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a"; $sql.= " WHERE a.statut = 1"; $sql.= " AND a.entity = ".$conf->entity; + $sql.= " AND (a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."')"; $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/adherents/liste.php b/htdocs/adherents/liste.php index c92247726bf..5da5e4f4db2 100644 --- a/htdocs/adherents/liste.php +++ b/htdocs/adherents/liste.php @@ -291,18 +291,12 @@ if ($resql) print $adh->LibStatut($objp->statut,$objp->cotisation,$datefin,2); print ""; - // Date fin cotisation + // End of subscription date if ($datefin) { print ''; - if ($datefin < time() && $objp->statut > 0) - { - print dol_print_date($datefin,'day')." ".img_warning($langs->trans("SubscriptionLate")); - } - else - { - print dol_print_date($datefin,'day'); - } + print dol_print_date($datefin,'day'); + if ($datefin < ($now - $conf->adherent->cotisation->warning_delay) && $objp->statut > 0) print " ".img_warning($langs->trans("SubscriptionLate")); print ''; } else