66 global $conf, $user, $langs;
68 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
69 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
70 $memberstatic =
new Adherent($this->db);
72 $langs->load(
"boxes");
76 $this->info_box_head = array(
'text' => $langs->trans(
"BoxTitleMemberNextBirthdays"));
78 if ($user->hasRight(
'adherent',
'lire')) {
83 $sql =
"SELECT u.rowid, u.firstname, u.lastname, u.societe, u.birth, date_format(u.birth, '%d') as daya, u.email, u.statut as status, u.datefin";
84 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as u";
85 $sql .=
" WHERE u.entity IN (".getEntity(
'adherent').
")";
86 $sql .=
" AND u.statut = ".Adherent::STATUS_VALIDATED;
88 $sql .=
" ORDER BY daya ASC";
89 $sql .= $this->db->plimit($max, 0);
91 dol_syslog(get_class($this).
"::loadBox", LOG_DEBUG);
92 $resql = $this->db->query($sql);
94 $num = $this->db->num_rows($resql);
97 while ($line < $num) {
98 $data[$line] = $this->db->fetch_object($resql);
103 $this->db->free($resql);
108 while ($j < count($data)) {
109 $memberstatic->id = $data[$j]->rowid;
110 $memberstatic->firstname = $data[$j]->firstname;
111 $memberstatic->lastname = $data[$j]->lastname;
112 $memberstatic->company = $data[$j]->societe;
113 $memberstatic->email = $data[$j]->email;
114 $memberstatic->status = $data[$j]->status;
115 $memberstatic->statut = $data[$j]->status;
116 $memberstatic->datefin = $this->db->jdate($data[$j]->datefin);
118 $dateb = $this->db->jdate($data[$j]->birth);
119 $age = idate(
'Y',
dol_now()) - idate(
'Y', $dateb);
121 $typea =
'<i class="fas fa-birthday-cake inline-block"></i>';
123 $this->info_box_contents[$j][0] = array(
125 'text' => $memberstatic->getNomUrl(1),
129 $this->info_box_contents[$j][1] = array(
130 'td' =>
'class="center nowraponall"',
131 'text' =>
dol_print_date($dateb,
"day",
'tzserver').
' - '.$age.
' '.$langs->trans(
'DurationYears')
134 $this->info_box_contents[$j][2] = array(
135 'td' =>
'class="right nowraponall"',
148 if (is_array($data) && count($data) == 0) {
149 $this->info_box_contents[0][0] = array(
150 'td' =>
'class="center"',
151 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>',
155 $this->info_box_contents[0][0] = array(
156 'td' =>
'class="nohover left"',
157 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'