diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 5c7e658fed5..77358c08799 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2009 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 @@ -40,6 +40,7 @@ llxHeader('',$langs->trans("Members"),'EN:Module_Foundations|FR:Module_Adh&eacut $staticmember=new Adherent($db); $statictype=new AdherentType($db); +$subscriptionstatic=new Cotisation($db); print_fiche_titre($langs->trans("MembersArea")); @@ -195,6 +196,109 @@ print ''; $var=true; +/* + * Last modified members + */ +$max=5; + +$sql = "SELECT a.rowid, a.statut, a.nom, a.prenom,"; +$sql.= " a.tms as datem, datefin as date_end_subscription,"; +$sql.= " ta.rowid as typeid, ta.libelle, ta.cotisation"; +$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta"; +$sql.= " WHERE a.fk_adherent_type = ta.rowid"; +$sql.= $db->order("a.tms","DESC"); +$sql.= $db->plimit($max, 0); + +$resql=$db->query($sql); +if ($resql) +{ + print ''; + print ''; + print ''; + + $num = $db->num_rows($resql); + if ($num) + { + $i = 0; + $var = True; + while ($i < $num) + { + $var=!$var; + $obj = $db->fetch_object($resql); + print ""; + $staticmember->id=$obj->rowid; + $staticmember->ref=trim($obj->prenom.' '.$obj->nom); + $statictype->id=$obj->typeid; + $statictype->libelle=$obj->libelle; + print ''; + print ''; + print ''; + print ''; + print ''; + $i++; + } + } + print "
'.$langs->trans("LastMembersModified",$max).'
'.$staticmember->getNomUrl(1,24).''.$statictype->getNomUrl(1,16).''.dol_print_date($db->jdate($obj->date_end),'dayhour').''.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'

"; +} +else +{ + dol_print_error($db); +} + + +/* + * Last modified subscriptions + */ +$max=5; + +$sql = "SELECT a.rowid, a.statut, a.nom, a.prenom,"; +$sql.= " datefin as date_end_subscription,"; +$sql.= " c.rowid as cid, c.tms as datem, c.dateadh as date_start, c.datef as date_end, c.cotisation"; +$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."cotisation as c"; +$sql.= " WHERE c.fk_adherent = a.rowid"; +$sql.= $db->order("c.tms","DESC"); +$sql.= $db->plimit($max, 0); + +$resql=$db->query($sql); +if ($resql) +{ + print ''; + print ''; + print ''; + + $num = $db->num_rows($resql); + if ($num) + { + $i = 0; + $var = True; + while ($i < $num) + { + $var=!$var; + $obj = $db->fetch_object($resql); + print ""; + $subscriptionstatic->id=$obj->cid; + $subscriptionstatic->ref=$obj->cid; + $staticmember->id=$obj->rowid; + $staticmember->nom=$obj->nom; + $staticmember->prenom=$obj->prenom; + $staticmember->ref=$staticmember->getFullName($langs); + print ''; + print ''; + print ''; + print ''; + //print ''; + print ''; + $i++; + } + } + print "
'.$langs->trans("LastSubscriptionsModified",$max).'
'.$subscriptionstatic->getNomUrl(1).''.$staticmember->getNomUrl(1,24,'subscription').''.get_date_range($db->jdate($obj->date_start),$db->jdate($obj->date_end)).''.price($obj->cotisation).''.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'

"; +} +else +{ + dol_print_error($db); +} + + // Summary of members by type print ''; print ''; @@ -227,56 +331,6 @@ print ''; print "
\n"; print "
\n"; -/* - * Last modified members - */ -$max=5; - -$sql = "SELECT a.rowid, a.statut, a.nom, a.prenom,"; -$sql.= " a.tms as datem, datefin as date_end_subscription,"; -$sql.= " ta.rowid as typeid, ta.libelle, ta.cotisation"; -$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta"; -$sql.= " WHERE a.fk_adherent_type = ta.rowid"; -$sql.= $db->order("a.tms","DESC"); -$sql.= $db->plimit($max, 0); - -$resql=$db->query($sql); -if ($resql) -{ - print ''; - print ''; - print ''; - - $num = $db->num_rows($resql); - if ($num) - { - $i = 0; - $var = True; - while ($i < $num) - { - $var=!$var; - $obj = $db->fetch_object($resql); - print ""; - $staticmember->id=$obj->rowid; - $staticmember->ref=trim($obj->prenom.' '.$obj->nom); - $statictype->id=$obj->typeid; - $statictype->libelle=$obj->libelle; - print ''; - print ''; - print ''; - print ''; - print ''; - $i++; - } - } - print "
'.$langs->trans("LastMembersModified",$max).'
'.$staticmember->getNomUrl(1,24).''.$statictype->getNomUrl(1,16).''.dol_print_date($db->jdate($obj->datem),'dayhour').''.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'

"; -} -else -{ - dol_print_error($db); -} - - // List of subscription by year $Total=array(); diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index b4debcc90d3..1b462873071 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -117,6 +117,7 @@ ExportDataset_member_1=Members and subscriptions ImportDataset_member_1=Members LastMembers=Last %s members LastMembersModified=Last %s modified members +LastSubscriptionsModified=Last %s modified subscriptions AttributeName=Attribute name FieldEdition=Edition of field %s AlphaNumOnlyCharsAndNoSpace=only alphanumericals characters without space diff --git a/htdocs/langs/fr_FR/members.lang b/htdocs/langs/fr_FR/members.lang index 6d55546256d..ab08aacd735 100644 --- a/htdocs/langs/fr_FR/members.lang +++ b/htdocs/langs/fr_FR/members.lang @@ -121,6 +121,7 @@ ExportDataset_member_1=Adhérents et adhésions ImportDataset_member_1=Adhérents LastMembers=Les %s derniers adhérents LastMembersModified=Les %s derniers adhérents modifiés +LastSubscriptionsModified=Les %s dernières adhésions modifiées AttributeName=Nom de l'attribut FieldEdition=Édition du champ %s AlphaNumOnlyCharsAndNoSpace=uniquement caractères alphanumériques sans espace