Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2026-04-07 03:44:29 +02:00
commit a8befde32c
9 changed files with 315 additions and 13 deletions

View file

@ -4,7 +4,7 @@
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -285,7 +285,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
}
// Action update description of emailing
if (($action == 'settitle' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto' || $action == 'setevenunsubscribe') && $permissiontocreate) {
if (($action == 'settitle' || $action == 'setemail_from' || $action == 'setemail_replyto' || $action == 'setemail_errorsto' || $action == 'setevenunsubscribe') && $permissiontocreate) {
$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, getDolGlobalInt('MAILING_USE_NEW_PATH_FOR_FILES') ? 0 : 2, 0, 1, $object, 'mailing');
$mesg = '';
@ -297,13 +297,15 @@ if (($action == 'settitle' || $action == 'setemail_from' || $action == 'setreply
$object->email_replyto = trim(GETPOST('email_replyto', 'alphawithlgt')); // Must allow 'name <email>'
} elseif ($action == 'setemail_errorsto') { // Test on permission already done
$object->email_errorsto = trim(GETPOST('email_errorsto', 'alphawithlgt')); // Must allow 'name <email>'
} elseif ($action == 'settitle' && empty($object->title)) { // Test on permission already done
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle"));
} elseif ($action == 'setfrom' && empty($object->email_from)) { // Test on permission already done
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom"));
} elseif ($action == 'setevenunsubscribe') { // Test on permission already done
$object->evenunsubscribe = (GETPOST('evenunsubscribe') ? 1 : 0);
}
if ($action == 'settitle' && empty($object->title)) { // Test on permission already done
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle"));
}
if ($action == 'setemail_from' && empty($object->email_from)) { // Test on permission already done
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom"));
}
if (!$mesg) {
$result = $object->update($user);

View file

@ -38,10 +38,12 @@
* Return array of tabs to used on pages for third parties cards.
*
* @param Societe $object Object company shown
* @param string $subtabs Parameter for choosing subtab, currently used for either conferenceorbooth or attendee
* @return array<array{0:string,1:string,2:string}> Array of tabs to show
*/
function societe_prepare_head(Societe $object)
function societe_prepare_head(Societe $object, $subtabs = '')
{
dol_syslog('Company::societe_prepare_head', LOG_DEBUG);
global $db, $langs, $conf, $user;
global $hookmanager;
@ -161,6 +163,7 @@ function societe_prepare_head(Societe $object)
}
if (isModEnabled('project') && ($user->hasRight('projet', 'lire'))) {
dol_syslog('Company::societe_prepare_head::isModEnabled::project', LOG_DEBUG);
$nbProject = 0;
// Enable caching of thirdrparty count projects
require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';
@ -263,6 +266,7 @@ function societe_prepare_head(Societe $object)
}
if ((isModEnabled('website') || isModEnabled('webportal')) && $user->hasRight('societe', 'lire')) {
dol_syslog('Company::societe_prepare_head::isModEnabled::website', LOG_DEBUG);
$site_filter_list = array();
if (isModEnabled('website')) {
$site_filter_list[] = 'dolibarr_website';
@ -326,6 +330,7 @@ function societe_prepare_head(Societe $object)
// Notifications
if (isModEnabled('ticket') && $user->hasRight("ticket", "read")) {
dol_syslog('Company::societe_prepare_head::isModEnabled::ticket', LOG_DEBUG);
//$langs->load('ticket');
$nbTicket = 0;
// Enable caching of thirdparty count notifications
@ -358,6 +363,65 @@ function societe_prepare_head(Societe $object)
$h++;
}
if (isModEnabled('eventorganization') && isModEnabled('project') && ($user->hasRight('projet', 'lire'))) {
dol_syslog('Company::societe_prepare_head::isModEnabled::eventorganization', LOG_DEBUG);
$langs->load('eventorganization');
if ($subtabs == 'attendees') {
$url_for_list = '/eventorganization/conferenceorboothattendee_list.php';
} else {
// this seems to be the default elsewhere, so let's keep that
$url_for_list = '/eventorganization/conferenceorbooth_list.php';
}
$head[$h][0] = dolBuildUrl(DOL_URL_ROOT . $url_for_list, ['thirdpartyid' => $object->id, 'withthirdparty' => 1]);
$head[$h][1] = $langs->trans("EventOrganization");
// Enable caching of conf or booth count
$nbConfOrBooth = 0;
$nbAttendees = 0;
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_conferenceorbooth_thirdparty_'.$object->id;
$dataretrieved = dol_getcache($cachekey);
if (!is_null($dataretrieved)) {
$nbConfOrBooth = $dataretrieved;
} else {
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
$conforbooth = new ConferenceOrBooth($db);
$result = $conforbooth->fetchAll('', '', 0, 0, '(t.fk_soc:=:'.((int) $object->id).")");
//,
if (!is_array($result) && $result < 0) {
setEventMessages($conforbooth->error, $conforbooth->errors, 'errors');
} else {
$nbConfOrBooth = count($result);
}
dol_setcache($cachekey, $nbConfOrBooth, 120); // If setting cache fails, this is not a problem, so we do not test result.
}
$cachekey = 'count_attendees_thirdparty_'.$object->id;
$dataretrieved = dol_getcache($cachekey);
if (!is_null($dataretrieved)) {
$nbAttendees = $dataretrieved;
} else {
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
$conforboothattendee = new ConferenceOrBoothAttendee($db);
$result = $conforboothattendee->fetchAll('', '', 0, 0, '(t.fk_soc:=:'.((int) $object->id).')');
if (!is_array($result) && $result < 0) {
setEventMessages($conforboothattendee->error, $conforboothattendee->errors, 'errors');
} else {
$nbAttendees = count($result);
}
dol_setcache($cachekey, $nbAttendees, 120); // If setting cache fails, this is not a problem, so we do not test result.
}
if ($nbConfOrBooth > 0 || $nbAttendees > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">';
$head[$h][1] .= '<span title="'.dol_escape_htmltag($langs->trans("ConferenceOrBooth")).'">'.$nbConfOrBooth.'</span>';
$head[$h][1] .= ' + ';
$head[$h][1] .= '<span title="'.dol_escape_htmltag($langs->trans("Attendees")).'">'.$nbAttendees.'</span>';
$head[$h][1] .= '</span>';
}
// why are the head eventorganisation with s and the module is eventorganization with z?
$head[$h][2] = 'eventorganization';
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
@ -450,6 +514,7 @@ function societe_prepare_head(Societe $object)
$head[$h][0] = dolBuildUrl(DOL_URL_ROOT . '/societe/messaging.php', ['socid' => $object->id]);
$head[$h][1] = $langs->trans("Events");
if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) {
dol_syslog('Company::societe_prepare_head::isModEnabled::agenda', LOG_DEBUG);
$nbEvent = 0;
// Enable caching of thirdparty count actioncomm
require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';

View file

@ -1635,11 +1635,12 @@ class pdf_azur extends ModelePDFPropales
$posy += 3;
$pdf->SetFont('', '', $default_font_size - 2);
if ($object->ref_client) {
$ref_customer = $object->ref_customer ?: $object->ref_client;
if ($ref_customer) {
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($ref_customer), '', 'R');
}
if (getDolGlobalString('PDF_SHOW_PROJECT_TITLE')) {
@ -1725,7 +1726,7 @@ class pdf_azur extends ModelePDFPropales
if (count($arrayidcontact) > 0) {
$object->fetch_user($arrayidcontact[0]);
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
$carac_emetteur .= $labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';

View file

@ -1861,7 +1861,7 @@ class pdf_cyan extends ModelePDFPropales
if (count($arrayidcontact) > 0) {
$object->fetch_user($arrayidcontact[0]);
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
$carac_emetteur .= $labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';

View file

@ -598,6 +598,9 @@ class ConferenceOrBooth extends ActionComm
if ($option == 'withproject') {
$url .= '&withproject=1';
}
if ($option == 'thirdpartyid') {
$url = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_list.php?thirdpartyid='.$this->id;
}
}
$linkclose = '';

View file

@ -818,6 +818,10 @@ class ConferenceOrBoothAttendee extends CommonObject
$url .= '&fk_project='.((int) $this->fk_project).'&withproject=1';
}
if ($option == 'thirdpartyid') {
$url = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_list.php?thirdpartyid='.$this->id;
}
if ($option == 'conforboothidproject') {
$url .= '&conforboothid='.((int) $this->fk_actioncomm).'&withproject=1';
}

View file

@ -65,6 +65,9 @@ $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hier
$id = GETPOSTINT('id');
$projectid = GETPOSTINT('projectid');
$projectref = GETPOST('ref', 'alpha');
$thirdpartyid = GETPOSTINT('thirdpartyid');
$withthirdparty = GETPOSTINT('withthirdparty');
$withThirdpartyUrl = '';
// Load variable for pagination
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
@ -84,7 +87,11 @@ $object = new ConferenceOrBooth($db);
$project = new Project($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->eventorganization->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
if ($thirdpartyid > 0) {
$hookmanager->initHooks(array('thirdpartybooth', 'globalcard'));
} else {
$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
}
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
@ -309,6 +316,72 @@ if ($projectid > 0 || $projectref) {
llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-eventorganization page-list bodyforlist');
// Copied almost verbertum from htdocs/ticket/list.php and modified based on the project one below
if ($thirdpartyid > 0 && $user->hasRight('societe', 'lire')) {
$withThirdpartyUrl = '';
if (!empty($withthirdparty)) {
// Tabs for thirdparty
$tab = 'eventorganisation'; // yes, it is called eventorganisation with s here and eventorganization with z elsewhere :-(
$withThirdpartyUrl = "&withthirdparty=1";
$socstat = new Societe($db);
$res = $socstat->fetch($thirdpartyid);
if ($res > 0) {
$tmpobject = $object;
$object = $socstat; // $object must be of type Societe when calling societe_prepare_head
$head = societe_prepare_head($socstat);
$object = $tmpobject;
print dol_get_fiche_head($head, 'eventorganization', $langs->trans("ThirdParty"), -1, 'company');
dol_banner_tab($socstat, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Type Prospect/Customer/Supplier
print '<tr><td class="titlefield">'.$langs->trans('NatureOfThirdParty').'</td><td>';
print $socstat->getTypeUrl(1);
print '</td></tr>';
// Customer code
if ($socstat->client && !empty($socstat->code_client)) {
print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td>';
print showValueWithClipboardCPButton(dol_escape_htmltag($socstat->code_client));
$tmpcheck = $socstat->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <span class="error">('.$langs->trans("WrongCustomerCode").')</span>';
}
print '</td>';
print '</tr>';
}
// Supplier code
if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td>';
print showValueWithClipboardCPButton(dol_escape_htmltag($socstat->code_fournisseur));
$tmpcheck = $socstat->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <span class="error">('.$langs->trans("WrongSupplierCode").')</span>';
}
print '</td>';
print '</tr>';
}
print '</table>';
print '</div>';
print dol_get_fiche_end();
$head = conferenceorboothThirdpartyPrepareHead($socstat);
$tab = 'conferenceorbooth';
print dol_get_fiche_head($head, $tab, $langs->trans("ThirdParty"), -1, 'company', 0, '', 'reposition');
}
}
}
if ($projectid > 0) {
// To verify role of users
@ -614,6 +687,9 @@ if ($object->ismultientitymanaged == 1) {
if ($projectid > 0) {
$sql .= " AND t.fk_project = ".((int) $project->id);
}
if (!empty($thirdpartyid)) {
$sql .= " AND t.fk_soc = ".((int) $thirdpartyid);
}
foreach ($search as $key => $val) {
if (array_key_exists($key, $object->fields)) {
if ($key == 'status' && $search[$key] == -1) {

View file

@ -72,8 +72,11 @@ $withproject = GETPOSTINT('withproject');
$fk_project = GETPOSTINT('fk_project') ? GETPOSTINT('fk_project') : GETPOSTINT('projectid');
$projectid = $fk_project;
$projectref = GETPOST('projectref');
$withthirdparty = GETPOSTINT('withthirdparty');
$thirdpartyid = GETPOSTINT('thirdpartyid');
$withProjectUrl = '';
$withThirdpartyUrl = '';
// Load variable for pagination
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
@ -94,7 +97,11 @@ $project = new Project($db);
$projectstatic = new Project($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->eventorganization->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('conferenceorboothattendeelist')); // Note that conf->hooks_modules contains array
if ($thirdpartyid > 0) {
$hookmanager->initHooks(array('thirdpartyattendee', 'globalcard'));
} else {
$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
}
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
@ -306,6 +313,9 @@ if ($object->ismultientitymanaged == 1) {
if (!empty($projectstatic->id)) {
$sql .= " AND t.fk_project = ".((int) $projectstatic->id);
}
if (!empty($thirdpartyid)) {
$sql .= " AND t.fk_soc = ".((int) $thirdpartyid);
}
foreach ($search as $key => $val) {
if (array_key_exists($key, $object->fields)) {
if ($key == 'status' && $search[$key] == -1) {
@ -400,7 +410,74 @@ if ($confOrBooth->id > 0) {
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-eventorganization page-attendee-list classforhorizontalscrolloftabs');
// Copied almost verbertum from htdocs/ticket/list.php and modified based on the project one below
if (($thirdpartyid > 0 && $user->hasRight('societe', 'lire')) || $confOrBooth > 0) {
$withThirdpartyUrl = '';
if (!empty($withthirdparty)) {
// Tabs for thirdparty
$tab = 'eventorganisation'; // yes, it is called eventorganisation with s here and eventorganization with z elsewhere :-(
$withThirdpartyUrl = "&withthirdparty=1";
$socstat = new Societe($db);
$res = $socstat->fetch($thirdpartyid);
if ($res > 0) {
$tmpobject = $object;
$object = $socstat; // $object must be of type Societe when calling societe_prepare_head
$head = societe_prepare_head($socstat, 'attendees');
$object = $tmpobject;
print dol_get_fiche_head($head, 'eventorganization', $langs->trans("ThirdParty"), -1, 'company');
dol_banner_tab($socstat, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Type Prospect/Customer/Supplier
print '<tr><td class="titlefield">'.$langs->trans('NatureOfThirdParty').'</td><td>';
print $socstat->getTypeUrl(1);
print '</td></tr>';
// Customer code
if ($socstat->client && !empty($socstat->code_client)) {
print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td>';
print showValueWithClipboardCPButton(dol_escape_htmltag($socstat->code_client));
$tmpcheck = $socstat->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <span class="error">('.$langs->trans("WrongCustomerCode").')</span>';
}
print '</td>';
print '</tr>';
}
// Supplier code
if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td>';
print showValueWithClipboardCPButton(dol_escape_htmltag($socstat->code_fournisseur));
$tmpcheck = $socstat->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <span class="error">('.$langs->trans("WrongSupplierCode").')</span>';
}
print '</td>';
print '</tr>';
}
print '</table>';
print '</div>';
print dol_get_fiche_end();
if (empty($confOrBooth->id)) {
$head = conferenceorboothThirdpartyPrepareHead($socstat);
$tab = 'attendees';
print dol_get_fiche_head($head, $tab, $langs->trans("ThirdParty"), -1, 'company', 0, '', 'reposition');
}
}
}
}
if ($projectstatic->id > 0 || $confOrBooth > 0) {
if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {

View file

@ -186,6 +186,80 @@ function conferenceorboothProjectPrepareHead($object)
return $head;
}
/**
* Prepare array of tabs for ConferenceOrBooth Thirdparty tab
*
* @param Societe $object Societe
* @return array<array{0:string,1:string,2:string}>
*/
function conferenceorboothThirdpartyPrepareHead($object)
{
dol_syslog('conferenceorboothThirdpartyPrepareHead', LOG_DEBUG);
global $db, $langs, $conf;
$langs->load("eventorganization");
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT . '/eventorganization/conferenceorbooth_list.php?thirdpartyid=' . $object->id . '&withthirdparty=1';
$head[$h][1] = $langs->trans("ConferenceOrBooth");
$head[$h][2] = 'conferenceorbooth';
// Enable caching of conf or booth count attendees
$nbAttendees = 0;
$nbConferenceOrBooth = 0;
require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';
$cachekey = 'count_conferenceorbooth_thirdparty_' . $object->id;
$dataretrieved = dol_getcache($cachekey);
if (!is_null($dataretrieved)) {
$nbAttendees = $dataretrieved;
} else {
require_once DOL_DOCUMENT_ROOT . '/eventorganization/class/conferenceorbooth.class.php';
$conforbooth = new ConferenceOrBooth($db);
$result = $conforbooth->fetchAll('', '', 0, 0, '(t.fk_soc:=:' . ((int) $object->id) . ')');
if (!is_array($result) && $result < 0) {
setEventMessages($conforbooth->error, $conforbooth->errors, 'errors');
} else {
$nbConferenceOrBooth = count($result);
}
dol_setcache($cachekey, $nbConferenceOrBooth, 120); // If setting cache fails, this is not a problem, so we do not test result.
}
if ($nbConferenceOrBooth > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbConferenceOrBooth . '</span>';
}
$h++;
$head[$h][0] = DOL_URL_ROOT . '/eventorganization/conferenceorboothattendee_list.php?thirdpartyid=' . $object->id . '&withthirdparty=1';
$head[$h][1] = $langs->trans("Attendees");
$head[$h][2] = 'attendees';
// Enable caching of conf or booth count attendees
$nbAttendees = 0;
require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';
$cachekey = 'count_attendees_conferenceorbooth_thirdparty_' . $object->id;
$dataretrieved = dol_getcache($cachekey);
if (!is_null($dataretrieved)) {
$nbAttendees = $dataretrieved;
} else {
require_once DOL_DOCUMENT_ROOT . '/eventorganization/class/conferenceorboothattendee.class.php';
$attendees = new ConferenceOrBoothAttendee($db);
$result = $attendees->fetchAll('', '', 0, 0, '(t.fk_soc:=:' . ((int) $object->id) . ')');
if (!is_array($result) && $result < 0) {
setEventMessages($attendees->error, $attendees->errors, 'errors');
} else {
$nbAttendees = count($result);
}
dol_setcache($cachekey, $nbAttendees, 120); // If setting cache fails, this is not a problem, so we do not test result.
}
if ($nbAttendees > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbAttendees . '</span>';
}
complete_head_from_modules($conf, $langs, $object, $head, $h, 'conferenceorbooththirdparty@eventorganization');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'conferenceorbooththirdparty@eventorganization', 'remove');
return $head;
}
/**
* Prepare array of tabs for ConferenceOrBoothAttendees