diff --git a/VERSIONS_HOTLINE/218050 b/VERSIONS_HOTLINE/218050 new file mode 100644 index 0000000000000000000000000000000000000000..021670660d838258bccef22cd3678737a4201ff3 --- /dev/null +++ b/VERSIONS_HOTLINE/218050 @@ -0,0 +1 @@ + - correctif #218050 : Formulaire d'inscritpion à une session : n'affiche pas le message de placement en attente si le total max est à 0. \ No newline at end of file diff --git a/library/Class/SessionActivity.php b/library/Class/SessionActivity.php index 088161eb624d451623e921f198ae2fd24d3400d7..9843734d6356154e0f8e0d082de0f3f1ed16695b 100644 --- a/library/Class/SessionActivity.php +++ b/library/Class/SessionActivity.php @@ -763,6 +763,7 @@ class Class_SessionActivity extends Storm_Model_Abstract { public function acceptAttendeesOnlyInQueue(): bool { return $this->getQueueAttendees() + && $this->getEffectifTotalMax() > 0 && ($this->getTotalRegistered() >= $this->getEffectifTotalMax()); } diff --git a/tests/scenarios/Activities/ActivitiesWithQueueAndZeroTotalMaxTest.php b/tests/scenarios/Activities/ActivitiesWithQueueAndZeroTotalMaxTest.php new file mode 100644 index 0000000000000000000000000000000000000000..c35dfe881a234c7478afb4e949487a22cf9f028e --- /dev/null +++ b/tests/scenarios/Activities/ActivitiesWithQueueAndZeroTotalMaxTest.php @@ -0,0 +1,88 @@ +<?php +/** + * Copyright (c) 2012-2025, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class ActivitiesWithQueueAndZeroTotalMaxTest extends AbstractControllerTestCase +{ + public function setUp(): void + { + parent::setUp(); + $this->_buildTemplateProfil(['id' => 1]); + $time = new TimeSourceForTest('2024-04-01 14:00:00'); + + Class_Activity::setTimeSource($time); + Class_SessionActivity::setTimeSource($time); + Class_SessionActivityInscription::setTimeSource($time); + + Class_AdminVar::set('ACTIVITY', '1'); + Class_AdminVar::set('ACTIVITY_SESSION_QUOTAS', '1'); + + $groupe = $this->fixture(Class_UserGroup::class, + ['id' => 12, + 'libelle' => 'Stagiaires', + 'rights' => [Class_UserGroup::RIGHT_SUIVRE_ACTIVITY]]); + + $user = $this->fixture(Class_Users::class, + ['id' => 435, + 'prenom' => 'Chichi', + 'nom' => 'Ro', + 'login' => 'Chichiro', + 'password' => 'pwd', + 'mail' => 'chichi@ro.fr', + 'id_site' => 12, + 'user_groups' => [$groupe]]); + + ZendAfi_Auth::getInstance()->logUser($user); + + $this->fixture(Class_Activity::class, + ['id' => 33, + 'libelle' => 'Apprendre à nager']); + + $this->fixture(Class_SessionActivity::class, + ['id' => 35, + 'activity_id' => 33, + 'date_debut' => '2024-04-20', + 'date_fin' => '2024-04-20', + 'effectif_min' => 0, + 'effectif_max' => 3, + 'effectif_child_min' => 0, + 'effectif_child_max' => 0, + 'age_child_max' => 0, + 'effectif_inscription_max' => 2, + 'effectif_inscription_child_max' => 0, + 'effectif_total_min' => 0, + 'effectif_total_max' => 0, + 'duree'=> 2, + 'contenu' => 'Intro à la natation', + 'horaires' => '9h', + 'date_limite_inscription'=>'2024-04-19', + 'queue_attendees' => true + ]); + + $this->dispatch('/opac/abonne/inscrire-session/id/35'); + } + + /** @test */ + public function messageYouWillBePutInQueueShouldNotBeDisplayed() + { + $this->assertNotXpathContentContains('//div', 'Vous serez placé.e en liste d\'attente'); + } +}