diff --git a/view/session/session_card.php b/view/session/session_card.php
index 0763566..5293c00 100644
--- a/view/session/session_card.php
+++ b/view/session/session_card.php
@@ -460,23 +460,41 @@
// Print form confirm
print $formconfirm;
- $signatoriesArray = $signatory->fetchSignatories($object->id, $object->element);
- $nbSessionTrainer = 0;
- $nbTrainee = 0;
- foreach ($signatoriesArray as $objectSignatory) {
- if ($objectSignatory->role == 'SessionTrainer') {
- $nbSessionTrainer++;
+ switch ($object->element) {
+ case 'meeting' :
+ $attendantsRole = ['Contributor', 'Responsible'];
+ break;
+ case 'trainingsession' :
+ $attendantsRole = ['Trainee', 'SessionTrainer'];
+ break;
+ case 'audit' :
+ $attendantsRole = ['Auditor'];
+ break;
+ default :
+ $attendantsRole = ['Attendant'];
+ }
+
+ $mesg = '';
+ $nbAttendantByRole = [];
+ $nbAttendants = 0;
+ foreach ($attendantsRole as $attendantRole) {
+ $signatories = $signatory->fetchSignatory($attendantRole, $object->id, $object->element);
+ if (is_array($signatories) && !empty($signatories)) {
+ foreach ($signatories as $objectSignatory) {
+ if ($objectSignatory->role == $attendantRole) {
+ $nbAttendantByRole[$attendantRole]++;
+ }
+ }
} else {
- $nbTrainee++;
+ $nbAttendantByRole[$attendantRole] = 0;
+ }
+ if ($nbAttendantByRole[$attendantRole] == 0) {
+ $mesg .= $langs->trans('NoAttendant', $langs->trans($attendantRole), $langs->transnoentities('The' . ucfirst($object->element))) . '
';
}
}
- $mesg = '';
- if ($nbSessionTrainer == 0) {
- $mesg .= $langs->trans('NoAttendant', $langs-> trans('SessionTrainer'), $langs->transnoentities('The' . ucfirst($object->element))) . '
';
- }
- if ($nbTrainee == 0) {
- $mesg .= $langs->trans('NoAttendant', $langs-> trans('Trainee'), $langs->transnoentities('The' . ucfirst($object->element)));
+ if (!in_array(0, $nbAttendantByRole)) {
+ $nbAttendants = 1;
}
print '