From 00f5904b669ee640c01f07a7a1b604df8143ea7e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Sep 2023 12:38:43 +0200 Subject: [PATCH] Close #21912 --- htdocs/adherents/type.php | 15 ++++++++++++++- htdocs/compta/facture/invoicetemplate_list.php | 9 ++++++++- htdocs/fourn/facture/list-rec.php | 13 +++++++++++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index c8857748294..7d201cd2625 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -252,7 +252,7 @@ $arrayofselected = is_array($toselect) ? $toselect : array(); if (!$rowid && $action != 'create' && $action != 'edit') { //print dol_get_fiche_head(''); - $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.caneditamount, d.vote, d.statut as status, d.morphy"; + $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.caneditamount, d.vote, d.statut as status, d.morphy, d.duration"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " WHERE d.entity IN (".getEntity('member_type').")"; @@ -309,6 +309,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''.$langs->trans("Ref").''; print ''.$langs->trans("Label").''; print ''.$langs->trans("MembersNature").''; + print ''.$langs->trans("MembershipDuration").''; print ''.$langs->trans("SubscriptionRequired").''; print ''.$langs->trans("Amount").''; print ''.$langs->trans("CanEditAmountShort").''; @@ -372,6 +373,18 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print $langs->trans("MorAndPhy"); } 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")); + } + $unit = preg_replace("/[^a-zA-Z]+/", "", $objp->duration); + print max(1, $duration_value).' '.$dur[$unit]; + } + print ''; print ''.yn($objp->subscription).''; print ''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).''; print ''.yn($objp->caneditamount).''; diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 00af699da22..5554b2d7310 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -946,7 +946,14 @@ while ($i < $imaxinloop) { } } if (!empty($arrayfields['f.unit_frequency']['checked'])) { - print ''.($objp->frequency > 0 ? $objp->unit_frequency : '').''; + print ''; + if ($objp->frequency > 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")); + } + print ($objp->frequency > 0 ? $dur[$objp->unit_frequency] : ''); + print ''; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/fourn/facture/list-rec.php b/htdocs/fourn/facture/list-rec.php index e90aca5a576..a6a7da35a2d 100644 --- a/htdocs/fourn/facture/list-rec.php +++ b/htdocs/fourn/facture/list-rec.php @@ -769,13 +769,22 @@ if ($resql) { } } if (!empty($arrayfields['f.frequency']['checked'])) { - print ''.($objp->frequency > 0 ? $objp->frequency : '').''; + print ''; + print ($objp->frequency > 0 ? $objp->frequency : ''); + print ''; if (!$i) { $totalarray['nbfield']++; } } if (!empty($arrayfields['f.unit_frequency']['checked'])) { - print ''.($objp->frequency > 0 ? $objp->unit_frequency : '').''; + print ''; + if ($objp->frequency > 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")); + } + print ($objp->frequency > 0 ? $dur[$objp->unit_frequency] : ''); + print ''; if (!$i) { $totalarray['nbfield']++; }