NEW : add employment anniversary in birthday box
This commit is contained in:
parent
6b5fac432f
commit
3a2cfe1fab
@ -85,13 +85,19 @@ class box_birthdays extends ModeleBoxes
|
|||||||
if ($user->rights->user->user->lire) {
|
if ($user->rights->user->user->lire) {
|
||||||
$tmparray = dol_getdate(dol_now(), true);
|
$tmparray = dol_getdate(dol_now(), true);
|
||||||
|
|
||||||
$sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth, u.email, u.statut as status";
|
$sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth as datea, 'birth' as typea, u.email, u.statut as status";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql .= " WHERE u.entity IN (".getEntity('user').")";
|
$sql .= " WHERE u.entity IN (".getEntity('user').")";
|
||||||
$sql .= " AND u.statut = 1";
|
$sql .= " AND u.statut = 1";
|
||||||
$sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0);
|
$sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0);
|
||||||
$sql .= " ORDER BY DAY(u.birth) ASC";
|
$sql .= ' UNION ';
|
||||||
$sql .= $this->db->plimit($max, 0);
|
$sql .= "SELECT u.rowid, u.firstname, u.lastname, u.dateemployment as datea, 'employment' as typea, u.email, u.statut as status";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||||
|
$sql .= " WHERE u.entity IN (".getEntity('user').")";
|
||||||
|
$sql .= " AND u.statut = 1";
|
||||||
|
$sql .= dolSqlDateFilter('u.dateemployment', 0, $tmparray['mon'], 0);
|
||||||
|
|
||||||
|
$sql .= " ORDER BY DAY(datea) ASC";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
|
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
@ -108,9 +114,13 @@ class box_birthdays extends ModeleBoxes
|
|||||||
$userstatic->email = $objp->email;
|
$userstatic->email = $objp->email;
|
||||||
$userstatic->statut = $objp->status;
|
$userstatic->statut = $objp->status;
|
||||||
|
|
||||||
$dateb = $this->db->jdate($objp->birth);
|
$dateb = $this->db->jdate($objp->datea);
|
||||||
$age = date('Y', dol_now()) - date('Y', $dateb);
|
$age = date('Y', dol_now()) - date('Y', $dateb);
|
||||||
|
|
||||||
|
$picb = '<i class="fas fa-birthday-cake inline-block"></i>';
|
||||||
|
$pice = '<i class="fas fa-briefcase inline-block"></i>';
|
||||||
|
$typea = ($objp->typea == 'birth') ? $picb : $pice;
|
||||||
|
|
||||||
$this->info_box_contents[$line][] = array(
|
$this->info_box_contents[$line][] = array(
|
||||||
'td' => '',
|
'td' => '',
|
||||||
'text' => $userstatic->getNomUrl(1),
|
'text' => $userstatic->getNomUrl(1),
|
||||||
@ -119,7 +129,18 @@ class box_birthdays extends ModeleBoxes
|
|||||||
|
|
||||||
$this->info_box_contents[$line][] = array(
|
$this->info_box_contents[$line][] = array(
|
||||||
'td' => 'class="center nowraponall"',
|
'td' => 'class="center nowraponall"',
|
||||||
'text' => dol_print_date($dateb, "day", 'tzserver').' - '.$age.' '.$langs->trans('DurationYears')
|
'text' => dol_print_date($dateb, "day", 'tzserver')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->info_box_contents[$line][] = array(
|
||||||
|
'td' => 'class="right nowraponall"',
|
||||||
|
'text' => $age.' '.$langs->trans('DurationYears')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->info_box_contents[$line][] = array(
|
||||||
|
'td' => 'class="center nowraponall"',
|
||||||
|
'text' => $typea,
|
||||||
|
'asis' => 1
|
||||||
);
|
);
|
||||||
|
|
||||||
/*$this->info_box_contents[$line][] = array(
|
/*$this->info_box_contents[$line][] = array(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user