fix duration display for service in list.php
This commit is contained in:
parent
26d34422b0
commit
d5aed3394d
@ -744,22 +744,28 @@ if ($resql)
|
|||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Duration
|
// Duration
|
||||||
if (! empty($arrayfields['p.duration']['checked']))
|
if (! empty($arrayfields['p.duration']['checked']))
|
||||||
{
|
|
||||||
print '<td align="center">';
|
|
||||||
if (preg_match('/([^a-z]+)[a-z]/i',$obj->duration))
|
|
||||||
{
|
{
|
||||||
if (preg_match('/([^a-z]+)y/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
|
print '<td align="center">';
|
||||||
elseif (preg_match('/([^a-z]+)m/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth");
|
|
||||||
elseif (preg_match('/([^a-z]+)w/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek");
|
$obj->duration_value = substr($obj->duration,0,dol_strlen($obj->duration)-1);
|
||||||
elseif (preg_match('/([^a-z]+)d/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay");
|
$obj->duration_unit = substr($obj->duration,-1);
|
||||||
//elseif (preg_match('/([^a-z]+)h/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour");
|
|
||||||
else print $obj->duration;
|
if ($obj->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 if ($obj->duration_value > 0)
|
||||||
|
{
|
||||||
|
$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 $obj->duration_value." ";
|
||||||
|
print (! empty($obj->duration_unit) && isset($dur[$obj->duration_unit]) ? $langs->trans($dur[$obj->duration_unit]) : '');
|
||||||
|
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
print '</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sell price
|
// Sell price
|
||||||
if (! empty($arrayfields['p.sellprice']['checked']))
|
if (! empty($arrayfields['p.sellprice']['checked']))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user