27 include_once DOL_DOCUMENT_ROOT.
'/core/boxes/modules_boxes.php';
35 public $boxcode =
"birthdays_members";
36 public $boximg =
"object_user";
37 public $boxlabel =
"BoxTitleMemberNextBirthdays";
38 public $depends = array(
"adherent");
47 public $info_box_head = array();
48 public $info_box_contents = array();
63 $this->hidden = !($user->hasRight(
"adherent",
"lire") && empty($user->socid));
74 global $conf, $user, $langs;
76 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
77 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
78 $memberstatic =
new Adherent($this->db);
80 $langs->load(
"boxes");
84 $this->info_box_head = array(
'text' => $langs->trans(
"BoxTitleMemberNextBirthdays"));
86 if ($user->hasRight(
'adherent',
'lire')) {
91 $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";
92 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as u";
93 $sql .=
" WHERE u.entity IN (".getEntity(
'adherent').
")";
94 $sql .=
" AND u.statut = ".Adherent::STATUS_VALIDATED;
96 $sql .=
" ORDER BY daya ASC";
97 $sql .= $this->db->plimit($max, 0);
99 dol_syslog(get_class($this).
"::loadBox", LOG_DEBUG);
100 $resql = $this->db->query(
$sql);
102 $num = $this->db->num_rows($resql);
105 while ($line < $num) {
106 $data[$line] = $this->db->fetch_object($resql);
111 $this->db->free($resql);
116 while ($j < count($data)) {
117 $memberstatic->id = $data[$j]->rowid;
118 $memberstatic->firstname = $data[$j]->firstname;
119 $memberstatic->lastname = $data[$j]->lastname;
120 $memberstatic->company = $data[$j]->societe;
121 $memberstatic->email = $data[$j]->email;
122 $memberstatic->status = $data[$j]->status;
123 $memberstatic->statut = $data[$j]->status;
124 $memberstatic->datefin = $this->db->jdate($data[$j]->datefin);
126 $dateb = $this->db->jdate($data[$j]->birth);
127 $age = date(
'Y',
dol_now()) - date(
'Y', $dateb);
129 $typea =
'<i class="fas fa-birthday-cake inline-block"></i>';
131 $this->info_box_contents[$j][0] = array(
133 'text' => $memberstatic->getNomUrl(1),
137 $this->info_box_contents[$j][1] = array(
138 'td' =>
'class="center nowraponall"',
139 'text' =>
dol_print_date($dateb,
"day",
'tzserver').
' - '.$age.
' '.$langs->trans(
'DurationYears')
142 $this->info_box_contents[$j][2] = array(
143 'td' =>
'class="right nowraponall"',
156 if (is_array($data) && count($data) == 0) {
157 $this->info_box_contents[0][0] = array(
158 'td' =>
'class="center"',
159 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>',
163 $this->info_box_contents[0][0] = array(
164 'td' =>
'class="nohover left"',
165 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'
178 public function showBox($head =
null, $contents =
null, $nooutput = 0)
180 return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
Class to manage members of a foundation.
Class to manage the box to show members birthdays.
showBox($head=null, $contents=null, $nooutput=0)
Method to show box.
__construct($db, $param='')
Constructor.
loadBox($max=20)
Load data for box to show them later.
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0, $gm=false)
Generate a SQL string to make a filter into a range (for second of date until last second of date).
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.