Merge pull request #6806 from mikee2/develop

New fields in Segment.php
This commit is contained in:
Laurent Destailleur 2017-09-21 11:42:31 +02:00 committed by GitHub
commit dafeb4c651

View File

@ -175,8 +175,18 @@ class Segment implements IteratorAggregate, Countable
{
global $langs;
$patterns=array('/__CURRENTDAY__/','/__CURRENTDAYTEXT__/','/__CURRENTMONTHSHORT__/','/__CURRENTMONTH__/','/__CURRENTYEAR__/');
$values=array(date('j'), $langs->trans(date('l')), $langs->trans(date('M')), $langs->trans(date('F')), date('Y'));
$hoy = dol_getdate(dol_now('tzuser'));
$dateinonemontharray = dol_get_next_month($hoy['mon'], $hoy['year']);
$nextMonth = $dateinonemontharray['month'];
$patterns=array( '/__CURRENTDAY__/u','/__CURENTWEEKDAY__/u',
'/__CURRENTMONTH__/u','/__CURRENTMONTHLONG__/u',
'/__NEXTMONTH__/u','/__NEXTMONTHLONG__/u',
'/__CURRENTYEAR__/u','/__NEXTYEAR__/u' );
$values=array( $hoy['mday'], $langs->transnoentitiesnoconv($hoy['weekday']),
$hoy['mon'], $langs->transnoentitiesnoconv($hoy['month']),
$nextMonth, monthArray($langs)[$nextMonth],
$hoy['year'], $hoy['year']+1 );
$text=preg_replace($patterns, $values, $text);