diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index bcef5f77474..ed96199e4c3 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -927,6 +927,7 @@ if ($resql) { } //var_dump($eventarray); + // BIRTHDATES CALENDAR // Complete $eventarray with birthdates if ($showbirthday) { @@ -972,6 +973,8 @@ if ($showbirthday) { $event->percentage = 100; $event->fulldayevent = 1; + $event->contact_id = $obj->rowid; + $event->date_start_in_calendar = $db->jdate($event->datep); $event->date_end_in_calendar = $db->jdate($event->datef); @@ -1800,7 +1803,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $color = ($event->icalcolor ? $event->icalcolor : -1); $cssclass = (!empty($event->icalname) ? 'family_ext'.md5($event->icalname) : 'family_other'); } elseif ($event->type_code == 'BIRTHDAY') { - $numbirthday++; $colorindex = 2; $cssclass = 'family_birthday '; $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]); + $numbirthday++; + $colorindex = 2; + $cssclass = 'family_birthday '; + $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]); } else { $numother++; $color = ($event->icalcolor ? $event->icalcolor : -1); @@ -1930,9 +1936,31 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $daterange = ''; - if ($event->type_code == 'BIRTHDAY') { // It's birthday calendar - print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'birthday', 'contact'); - } elseif ($event->type_code == 'HOLIDAY') { // It's holiday calendar + if ($event->type_code == 'BIRTHDAY') { + // It's birthday calendar + $picb = ''; + //$pice = ''; + //$typea = ($objp->typea == 'birth') ? $picb : $pice; + //var_dump($event); + print $picb.' '.$langs->trans("Birthday").'
'; + //print img_picto($langs->trans("Birthday"), 'birthday-cake').' '; + + $tmpid = $event->id; + if (empty($cachecontacts[$tmpid])) { + $newcontact = new Contact($db); + $newcontact->fetch($tmpid); + $cachecontact[$tmpid] = $newcontact; + } + print $cachecontact[$tmpid]->getNomUrl(1); + + //$event->picto = 'birthday-cake'; + //print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'birthday', 'contact'); + /*$listofcontacttoshow = ''; + $listofcontacttoshow .= '
'.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valignmiddle'); + print $listofcontacttoshow; + */ + } elseif ($event->type_code == 'HOLIDAY') { + // It's holiday calendar $tmpholiday->fetch($event->id); print $tmpholiday->getNomUrl(1); @@ -1947,8 +1975,8 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $listofusertoshow = ''; $listofusertoshow .= '
'.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valignmiddle'); print $listofusertoshow; - } else { // Other calendar - // Picto + } else { + // Other calendar if (empty($event->fulldayevent)) { //print $event->getNomUrl(2).' '; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f8074ffcd46..0e8aeb31518 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4131,7 +4131,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ if (empty($srconly) && in_array($pictowithouttext, array( '1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected', 'accountancy', 'accounting_account', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset', - 'bank_account', 'barcode', 'bank', 'bell', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'briefcase-medical', 'bug', 'building', + 'bank_account', 'barcode', 'bank', 'bell', 'bill', 'billa', 'billr', 'billd', 'birthday-cake', 'bookmark', 'bom', 'briefcase-medical', 'bug', 'building', 'card', 'calendarlist', 'calendar', 'calendarmonth', 'calendarweek', 'calendarday', 'calendarperuser', 'calendarpertype', 'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'conversation', 'cron', 'cubes', 'currency', 'multicurrency', @@ -11259,6 +11259,11 @@ function getElementProperties($element_type) $classpath = 'categories/class'; $module = 'categorie'; $subelement = 'categorie'; + } elseif ($element_type == 'contact') { + $classpath = 'contact/class'; + $classfile = 'contact'; + $module = 'societe'; + $subelement = 'contact'; } elseif ($element_type == 'stock') { $classpath = 'product/stock/class'; $classfile = 'entrepot'; @@ -11377,6 +11382,8 @@ function fetchObjectByElement($element_id, $element_type, $element_ref = '') $ret = 0; $element_prop = getElementProperties($element_type); + //var_dump($element_prop); + if (is_array($element_prop) && isModEnabled($element_prop['module'])) { dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php');