From 06e93aeb0ea0d314ec8d59423d7be438172b5cc8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 14 Feb 2024 04:46:59 +0100 Subject: [PATCH] Debug module bookcal --- htdocs/comm/action/index.php | 22 ++++++++++++---------- htdocs/contact/class/contact.class.php | 2 +- htdocs/societe/class/societe.class.php | 23 ++++++++++++----------- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index cbf37aae56d..62b5600af50 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1454,7 +1454,6 @@ if (count($listofextcals)) { } - // Complete $eventarray with events coming from external module $parameters = array(); $object = null; $reshook = $hookmanager->executeHooks('getCalendarEvents', $parameters, $object, $action); @@ -1861,6 +1860,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $jour = dol_print_date($daykey, '%d', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' //print 'event daykey='.$daykey.' dol_print_date(daykey)='.dol_print_date($daykey, 'dayhour', 'gmt').' jour='.$jour.' mois='.$mois.' annee='.$annee."
\n"; + //print 'event daykey='.$daykey.' dol_print_date(daykey)='.dol_print_date($daykey, 'dayhour', 'gmt').' day='.$day.' month='.$month.' year='.$year."
\n"; if ($day == $jour && $month == $mois && $year == $annee) { foreach ($eventarray[$daykey] as $index => $event) { @@ -1997,15 +1997,17 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($event->type == 'holiday' && !GETPOST('check_holiday')) { $morecss = 'hidden'; } + /* I comment this because it hides event recorded from bookcal online page if ($event->type == 'bookcal_calendar' && !GETPOST('check_bookcal_calendar_'.$bookcalcalendarsarray["availabilitieslink"][$event->fk_bookcal_calendar])) { $morecss = 'hidden'; - } + } */ if ($morecss != 'hidden') { $itoshow++; } if ($morecss != 'showifmore' && $morecss != 'hidden') { $ireallyshown++; } + //var_dump($event->type.' - '.$morecss.' - '.$cssclass.' - '.$i.' - '.$ireallyshown.' - '.$itoshow); if (isModEnabled("bookcal") && $event->type == 'bookcal_calendar') { print '
fk_bookcal_calendar].' '.$cssclass.($morecss ? ' '.$morecss : '').'"'; @@ -2060,7 +2062,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $newcontact->fetch($tmpid); $cachecontact[$tmpid] = $newcontact; } - print $cachecontact[$tmpid]->getNomUrl(1); + print $cachecontact[$tmpid]->getNomUrl(1, '', 0, '', -1, 0, 'valignmiddle inline-block'); //$event->picto = 'birthday-cake'; //print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'birthday', 'contact'); @@ -2072,7 +2074,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa // It's holiday calendar $tmpholiday->fetch($event->id); - print $tmpholiday->getNomUrl(1); + print $tmpholiday->getNomUrl(1, -1, 0, 'valignmiddle inline-block'); $tmpid = $tmpholiday->fk_user; if (empty($cacheusers[$tmpid])) { @@ -2082,7 +2084,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } $listofusertoshow = ''; - $listofusertoshow .= '
'.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valignmiddle'); + $listofusertoshow .= '
'.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valignmiddle inline-block'); print $listofusertoshow; } @@ -2145,7 +2147,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $event->libelle = $titletoshow; // deprecatd // Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user. $titletoshow = (($event->type_picto || $event->type_code) ? $event->getTypePicto() : ''); - $titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title', '', 0, 0); + $titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title valignmiddle inline-block', '', 0, 0); $event->label = $savlabel; $event->libelle = $savlabel; } @@ -2164,11 +2166,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $cacheusers[$tmpid] = $newuser; } - $listofusertoshow .= $cacheusers[$tmpid]->getNomUrl(-3, '', 0, 0, 0, 0, '', 'valignmiddle'); + $listofusertoshow .= $cacheusers[$tmpid]->getNomUrl(-3, '', 0, 0, 0, 0, '', 'valignmiddle inline-block'); } print $titletoshow; - print $listofusertoshow; + print $listofusertoshow.'  '; if ($event->type_code == 'ICALEVENT') { print '
('.dol_trunc($event->icalname, $maxnbofchar).')'; @@ -2188,7 +2190,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $thirdparty = $cachethirdparties[$thirdparty_id]; } if (!empty($thirdparty->id)) { - $linerelatedto .= $thirdparty->getNomUrl(1, '', 0); + $linerelatedto .= $thirdparty->getNomUrl(1, '', 0, 0, -1, 0, '', 'valignmiddle inline-block'); } } if (!empty($contact_id) && $contact_id > 0) { @@ -2203,7 +2205,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $linerelatedto .= ' '; } if (!empty($contact->id)) { - $linerelatedto .= $contact->getNomUrl(1, '', 0); + $linerelatedto .= $contact->getNomUrl(1, '', 0, '', -1, 0, 'valignmiddle inline-block'); } } if (!empty($event->fk_element) && $event->fk_element > 0 && !empty($event->elementtype) && getDolGlobalString('AGENDA_SHOW_LINKED_OBJECT')) { diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index b58f6541a5a..00b137332c0 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1515,7 +1515,7 @@ class Contact extends CommonObject $result .= ' '; } } else { - $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="pictofixedwidth"' : '') : 'class="'.(($withpicto != 2) ? 'pictofixedwidth ' : '').'"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="pictofixedwidth valignmiddle"' : '') : 'class="'.(($withpicto != 2) ? 'pictofixedwidth valignmiddle' : '').'"'), 0, 0, $notooltip ? 0 : 1); } } if ($withpicto != 2 && $withpicto != -2) { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9d9a6541057..b19c0b8a695 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2847,16 +2847,17 @@ class Societe extends CommonObject /** * Return a link on thirdparty (with picto) * - * @param int $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only) - * @param string $option Target of link ('', 'customer', 'prospect', 'supplier', 'project') - * @param int $maxlen Max length of name - * @param int $notooltip 1=Disable tooltip - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking - * @param int $noaliasinname 1=Do not add alias into the link ref - * @param string $target add attribute target - * @return string String with URL + * @param int $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only) + * @param string $option Target of link ('', 'customer', 'prospect', 'supplier', 'project') + * @param int $maxlen Max length of name + * @param int $notooltip 1=Disable tooltip + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int $noaliasinname 1=Do not add alias into the link ref + * @param string $target add attribute target + * @param string $morecss More CSS + * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $notooltip = 0, $save_lastsearch_value = -1, $noaliasinname = 0, $target = '') + public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $notooltip = 0, $save_lastsearch_value = -1, $noaliasinname = 0, $target = '', $morecss = '') { global $conf, $langs, $hookmanager, $user; @@ -2960,13 +2961,13 @@ class Societe extends CommonObject $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); - $linkclose .= $dataparams.' class="'.$classfortooltip.' refurl valignmiddle"'; + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').' refurl valignmiddle"'; $target_value = array('_self', '_blank', '_parent', '_top'); if (in_array($target, $target_value)) { $linkclose .= ' target="'.dol_escape_htmltag($target).'"'; } } else { - $linkclose .= ' class="valignmiddle"'; + $linkclose .= ' class="valignmiddle'.($morecss ? ' '.$morecss : '').'"'; } $linkstart .= $linkclose.'>'; $linkend = '';