diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index cf6f9d54649..eca8668e308 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -13,6 +13,7 @@ * Copyright (C) 2018-2019 Thibault FOUCART * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2020 Josep Lluís Amador + * Copyright (C) 2021 Waël Almoman * * 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 diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index b4347277b5d..460cefdeed3 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2009-2017 Regis Houssin * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018-2019 Thibault Foucart + * Copyright (C) 2021 Waël Almoman * * 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 diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 803ef89bb22..0340af431f7 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2021 Frédéric France + * Copyright (C) 2021 Waël Almoman * * 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 diff --git a/htdocs/core/boxes/box_members_by_type.php b/htdocs/core/boxes/box_members_by_type.php index 79610a3e988..5bc05b6fabd 100644 --- a/htdocs/core/boxes/box_members_by_type.php +++ b/htdocs/core/boxes/box_members_by_type.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015-2020 Frederic France + * Copyright (C) 2021 Waël Almoman * * 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 @@ -93,12 +94,14 @@ class box_members_by_type extends ModeleBoxes $MembersToValidate = array(); $MembersValidated = array(); $MemberUpToDate = array(); + $MembersExcluded = array(); $MembersResiliated = array(); - $SommeA = 0; - $SommeB = 0; - $SommeC = 0; - $SommeD = 0; + $SumToValidate = 0; + $SumValidated = 0; + $SumUpToDate = 0; + $SumResiliated = 0; + $SumExcluded = 0; $AdherentType = array(); @@ -132,6 +135,9 @@ class box_members_by_type extends ModeleBoxes if ($objp->statut == 1) { $MembersValidated[$objp->rowid] = $objp->somme; } + if ($objp->statut == -2) { + $MembersExcluded[$objp->rowid] = $objp->somme; + } if ($objp->statut == 0) { $MembersResiliated[$objp->rowid] = $objp->somme; } @@ -181,16 +187,22 @@ class box_members_by_type extends ModeleBoxes 'td' => 'class="right"', 'text' => $langs->trans("UpToDate"), ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right"', + 'text' => $langs->trans("MembersStatusExcluded"), + ); $this->info_box_contents[$line][] = array( 'td' => 'class="right"', 'text' => $langs->trans("MembersStatusResiliated"), ); $line++; foreach ($AdherentType as $key => $adhtype) { - $SommeA += isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0; - $SommeB += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0; - $SommeC += isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0; - $SommeD += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0; + $SumToValidate += isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0; + $SumValidated += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : 0; + $SumUpToDate += isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0; + $SumExcluded += isset($MembersExcluded[$key]) ? $MembersExcluded [$key] : 0; + $SumResiliated += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0; + $this->info_box_contents[$line][] = array( 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', 'text' => $adhtype->getNomUrl(1, dol_size(32)), @@ -211,6 +223,11 @@ class box_members_by_type extends ModeleBoxes 'text' => (isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key] : '') . ' ' . $staticmember->LibStatut(1, 1, $now, 3), 'asis' => 1, ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right"', + 'text' => (isset($MembersExcluded[$key]) && $MembersExcluded[$key] > 0 ? $MembersExcluded[$key] : '') . ' ' . $staticmember->LibStatut(-2, 1, $now, 3), + 'asis' => 1, + ); $this->info_box_contents[$line][] = array( 'td' => 'class="right"', 'text' => (isset($MembersResiliated[$key]) && $MembersResiliated[$key] > 0 ? $MembersResiliated[$key] : '') . ' ' . $staticmember->LibStatut(0, 1, 0, 3), @@ -232,22 +249,27 @@ class box_members_by_type extends ModeleBoxes ); $this->info_box_contents[$line][] = array( 'td' => 'class="liste_total right"', - 'text' => $SommeA.' '.$staticmember->LibStatut(-1, 1, 0, 3), + 'text' => $SumToValidate.' '.$staticmember->LibStatut(-1, 1, 0, 3), 'asis' => 1 ); $this->info_box_contents[$line][] = array( 'td' => 'class="liste_total right"', - 'text' => $SommeB.' '.$staticmember->LibStatut(1, 1, 0, 3), + 'text' => $SumValidated.' '.$staticmember->LibStatut(1, 1, 0, 3), 'asis' => 1 ); $this->info_box_contents[$line][] = array( 'td' => 'class="liste_total right"', - 'text' => $SommeC.' '.$staticmember->LibStatut(1, 1, $now, 3), + 'text' => $SumUpToDate.' '.$staticmember->LibStatut(1, 1, $now, 3), 'asis' => 1 ); $this->info_box_contents[$line][] = array( 'td' => 'class="liste_total right"', - 'text' => $SommeD.' '.$staticmember->LibStatut(0, 1, 0, 3), + 'text' => $SumExcluded.' '.$staticmember->LibStatut(-2, 1, 0, 3), + 'asis' => 1 + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total right"', + 'text' => $SumResiliated.' '.$staticmember->LibStatut(0, 1, 0, 3), 'asis' => 1 ); }