From a8bd198a21f801ea8cf84df460d2c020fbd07835 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2022 12:26:48 +0100 Subject: [PATCH] FIX Subscription must be stopped when max of attendees reached. --- htdocs/public/eventorganization/attendee_new.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index e0ad4a0420b..4dabf1f6c91 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -103,14 +103,16 @@ if ($type == 'global') { $errmsg .= $project->error; $errors = array_merge($errors, $project->errors); } else { - $sql = "SELECT COUNT(*) as nb FROM ".MAIN_DB_PREFIX."projet"; - $sql .= " WHERE ".MAIN_DB_PREFIX."eventorganization_conferenceorboothattendee = ".((int) $project->id); + $sql = "SELECT COUNT(*) as nb FROM ".MAIN_DB_PREFIX."eventorganization_conferenceorboothattendee"; + $sql .= " WHERE fk_project = ".((int) $project->id); - $resql = $db->query($resql); + $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); if ($obj) { $currentnbofattendees = $obj->nb; + } else { + dol_print_error($db); } } }