From 841cd5f570ad44c9fabdc4b30ce73c3bf8e26445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jan 2025 19:08:08 +0100 Subject: [PATCH 1/5] enhance member types list --- htdocs/adherents/type.php | 45 +++++++++++++++++++++++---------- htdocs/langs/en_US/members.lang | 4 ++- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 91f105c48b8..25bdae150a5 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -9,7 +9,7 @@ * Copyright (C) 2020 Josep Lluís Amador * Copyright (C) 2021 Waël Almoman * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * 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 @@ -136,6 +136,9 @@ $result = restrictedArea($user, 'adherent', $rowid, 'adherent_type'); */ $error = 0; +// Selection of new fields +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers $search_ref = ""; $search_lastname = ""; @@ -329,8 +332,14 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''; print ''; print ''; + print ''; + print ''; print ''; + $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; + $htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup + $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : ''); + // $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -341,11 +350,18 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ' '; + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn '); + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.rowid']['checked'])) { + print ''.$langs->trans("Ref").''; + } + if (!empty($arrayfields['t.libelle']['checked'])) { + print ''.$langs->trans($arrayfields['t.libelle']['label']).''; + } + if (!empty($arrayfields['t.morphy']['checked'])) { + print ''.$langs->trans("MembersNature").''; } - print ''.$langs->trans("Ref").''; - print ''.$langs->trans("Label").''; - print ''.$langs->trans("MembersNature").''; print ''.$langs->trans("MembershipDuration").''; print ''.$langs->trans("SubscriptionRequired").''; print ''.$langs->trans("Amount").''; @@ -353,7 +369,8 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''.$langs->trans("VoteAllowed").''; print ''.$langs->trans("Status").''; if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ' '; + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); + $totalarray['nbfield']++; } print "\n"; @@ -397,13 +414,15 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print 'rowid.'">'.img_edit().''; } } - - print ''; - print $membertype->getNomUrl(1); - //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' - print ''; - - print ''.dol_escape_htmltag($objp->label).''; + if (!empty($arrayfields['t.rowid']['checked'])) { + print ''; + print $membertype->getNomUrl(1); + //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' + print ''; + } + if (!empty($arrayfields['t.libelle']['checked'])) { + print ''.dol_escape_htmltag($objp->label).''; + } print ''; if ($objp->morphy == 'phy') { diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 4d1c90f9e1b..a4cecf6be82 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -191,7 +191,7 @@ MembersStatisticsByRegion=Members statistics by region NbOfMembers=Total number of members NbOfActiveMembers=Total number of current active members NoValidatedMemberYet=No validated members found -MembersByCountryDesc=This screen shows you the statistics of members by countries. +MembersByCountryDesc=This screen shows you the statistics of members by countries. MembersByCountryDesc2=Graphs and charts depend on the availability of the Google online graph service as well as on the availability of a working internet connection. MembersByStateDesc=This screen show you statistics of members by state/provinces/canton. MembersByTownDesc=This screen show you statistics of members by town. @@ -251,3 +251,5 @@ XSubsriptionErrors=%s subscription(s) where in error CreateSubscription=Create subscription WarningNoComplementaryActionDone=No Complementary action on recording will be executed with this massaction NewMembership=New membership +Caneditamount=Can edit amount +Morphy=Moral or physical From 0338b5c65851f490b3458113a642b57a43910ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jan 2025 19:11:03 +0100 Subject: [PATCH 2/5] enhance member types list --- htdocs/adherents/type.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 25bdae150a5..c1584085f12 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -355,12 +355,15 @@ if (!$rowid && $action != 'create' && $action != 'edit') { } if (!empty($arrayfields['t.rowid']['checked'])) { print ''.$langs->trans("Ref").''; + $totalarray['nbfield']++; } if (!empty($arrayfields['t.libelle']['checked'])) { print ''.$langs->trans($arrayfields['t.libelle']['label']).''; + $totalarray['nbfield']++; } if (!empty($arrayfields['t.morphy']['checked'])) { print ''.$langs->trans("MembersNature").''; + $totalarray['nbfield']++; } print ''.$langs->trans("MembershipDuration").''; print ''.$langs->trans("SubscriptionRequired").''; @@ -423,16 +426,17 @@ if (!$rowid && $action != 'create' && $action != 'edit') { if (!empty($arrayfields['t.libelle']['checked'])) { print ''.dol_escape_htmltag($objp->label).''; } - - print ''; - if ($objp->morphy == 'phy') { - print $langs->trans("Physical"); - } elseif ($objp->morphy == 'mor') { - print $langs->trans("Moral"); - } else { - print $langs->trans("MorAndPhy"); + if (!empty($arrayfields['t.morphy']['checked'])) { + print ''; + if ($objp->morphy == 'phy') { + print $langs->trans("Physical"); + } elseif ($objp->morphy == 'mor') { + print $langs->trans("Moral"); + } else { + print $langs->trans("MorAndPhy"); + } + print ''; } - print ''; print ''; if ($objp->duration) { From de131d7d8ef262862c7dd18af426a82f4fbc3df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jan 2025 19:13:23 +0100 Subject: [PATCH 3/5] enhance member types list --- htdocs/adherents/type.php | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index c1584085f12..5e0a853eaa8 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -365,7 +365,10 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''.$langs->trans("MembersNature").''; $totalarray['nbfield']++; } - print ''.$langs->trans("MembershipDuration").''; + if (!empty($arrayfields['t.duration']['checked'])) { + print ''.$langs->trans("MembershipDuration").''; + $totalarray['nbfield']++; + } print ''.$langs->trans("SubscriptionRequired").''; print ''.$langs->trans("Amount").''; print ''.$langs->trans("CanEditAmountShort").''; @@ -437,19 +440,20 @@ if (!$rowid && $action != 'create' && $action != 'edit') { } print ''; } - - print ''; - if ($objp->duration) { - $duration_value = intval($objp->duration); - if ($duration_value > 1) { - $dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years")); - } else { - $dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year")); + if (!empty($arrayfields['t.duration']['checked'])) { + print ''; + if ($objp->duration) { + $duration_value = intval($objp->duration); + if ($duration_value > 1) { + $dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years")); + } else { + $dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year")); + } + $unit = preg_replace("/[^a-zA-Z]+/", "", $objp->duration); + print max(1, $duration_value).' '.$dur[$unit]; } - $unit = preg_replace("/[^a-zA-Z]+/", "", $objp->duration); - print max(1, $duration_value).' '.$dur[$unit]; + print ''; } - print ''; print ''.yn($objp->subscription).''; From d1adfb32a453e3f0b8d272d5657820a1812993db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jan 2025 19:21:44 +0100 Subject: [PATCH 4/5] enhance member types list --- htdocs/adherents/type.php | 51 +++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 5e0a853eaa8..221c76c7bfa 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -369,11 +369,26 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''.$langs->trans("MembershipDuration").''; $totalarray['nbfield']++; } - print ''.$langs->trans("SubscriptionRequired").''; - print ''.$langs->trans("Amount").''; - print ''.$langs->trans("CanEditAmountShort").''; - print ''.$langs->trans("VoteAllowed").''; - print ''.$langs->trans("Status").''; + if (!empty($arrayfields['t.subscription']['checked'])) { + print ''.$langs->trans("SubscriptionRequired").''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.amount']['checked'])) { + print ''.$langs->trans("Amount").''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.caneditamount']['checked'])) { + print ''.$langs->trans("CanEditAmountShort").''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.vote']['checked'])) { + print ''.$langs->trans("VoteAllowed").''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.statut']['checked'])) { + print ''.$langs->trans("Status").''; + $totalarray['nbfield']++; + } if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); $totalarray['nbfield']++; @@ -454,17 +469,21 @@ if (!$rowid && $action != 'create' && $action != 'edit') { } print ''; } - - print ''.yn($objp->subscription).''; - - print ''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).''; - - print ''.yn($objp->caneditamount).''; - - print ''.yn($objp->vote).''; - - print ''.$membertype->getLibStatut(5).''; - + if (!empty($arrayfields['t.subscription']['checked'])) { + print ''.yn($objp->subscription).''; + } + if (!empty($arrayfields['t.amount']['checked'])) { + print ''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).''; + } + if (!empty($arrayfields['t.caneditamount']['checked'])) { + print ''.yn($objp->caneditamount).''; + } + if (!empty($arrayfields['t.vote']['checked'])) { + print ''.yn($objp->vote).''; + } + if (!empty($arrayfields['t.statut']['checked'])) { + print ''.$membertype->getLibStatut(5).''; + } if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if ($user->hasRight('adherent', 'configurer')) { print 'rowid.'">'.img_edit().''; From 82eb875fabed66fe5554ac528f9e360a196abbbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jan 2025 19:34:35 +0100 Subject: [PATCH 5/5] enhance member types list --- htdocs/adherents/type.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 221c76c7bfa..7db9917b1d2 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -286,6 +286,9 @@ $help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_M llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-member page-type'); $arrayofselected = is_array($toselect) ? $toselect : array(); +$totalarray = [ + 'nbfield' => 0, +]; // List of members type if (!$rowid && $action != 'create' && $action != 'edit') {