This commit is contained in:
Laurent Destailleur 2023-09-11 12:38:43 +02:00
parent 61ca55b4d0
commit 00f5904b66
3 changed files with 33 additions and 4 deletions

View file

@ -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 '<th>'.$langs->trans("Ref").'</th>';
print '<th>'.$langs->trans("Label").'</th>';
print '<th class="center">'.$langs->trans("MembersNature").'</th>';
print '<th class="center">'.$langs->trans("MembershipDuration").'</th>';
print '<th class="center">'.$langs->trans("SubscriptionRequired").'</th>';
print '<th class="center">'.$langs->trans("Amount").'</th>';
print '<th class="center">'.$langs->trans("CanEditAmountShort").'</th>';
@ -372,6 +373,18 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print $langs->trans("MorAndPhy");
}
print '</td>';
print '<td class="center nowrap">';
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 '</td>';
print '<td class="center">'.yn($objp->subscription).'</td>';
print '<td class="center"><span class="amount">'.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).'</span></td>';
print '<td class="center">'.yn($objp->caneditamount).'</td>';

View file

@ -946,7 +946,14 @@ while ($i < $imaxinloop) {
}
}
if (!empty($arrayfields['f.unit_frequency']['checked'])) {
print '<td class="center">'.($objp->frequency > 0 ? $objp->unit_frequency : '').'</td>';
print '<td class="center">';
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 '</td>';
if (!$i) {
$totalarray['nbfield']++;
}

View file

@ -769,13 +769,22 @@ if ($resql) {
}
}
if (!empty($arrayfields['f.frequency']['checked'])) {
print '<td class="center">'.($objp->frequency > 0 ? $objp->frequency : '').'</td>';
print '<td class="center">';
print ($objp->frequency > 0 ? $objp->frequency : '');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['f.unit_frequency']['checked'])) {
print '<td class="center">'.($objp->frequency > 0 ? $objp->unit_frequency : '').'</td>';
print '<td class="center">';
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 '</td>';
if (!$i) {
$totalarray['nbfield']++;
}