From 637e1a8d211a65c0c0cee59868df80e40d44ddb0 Mon Sep 17 00:00:00 2001 From: mikee2 Date: Sat, 6 May 2017 10:49:37 +0200 Subject: [PATCH] Update Segment.php Add additional needed fields so that you can invoice yearly items. Have number and text descriptions to avoid future changes that may break existing invoices. --- htdocs/includes/odtphp/Segment.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/includes/odtphp/Segment.php b/htdocs/includes/odtphp/Segment.php index 81e9dad9f97..4310c716ee7 100644 --- a/htdocs/includes/odtphp/Segment.php +++ b/htdocs/includes/odtphp/Segment.php @@ -170,8 +170,16 @@ 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') ); + $nextMonth = strtotime('+1 month'); + + $patterns=array( '/__CURRENTDAY__/u','/__CURRENTDAYTEXT__/u', + '/__CURRENTMONTH__/u','/__CURRENTMONTHSHORT__/u','/__CURRENTMONTHLONG__/u', + '/__NEXTMONTH__/u','/__NEXTMONTHSHORT__/u','/__NEXTMONTHLONG__/u', + '/__CURRENTYEAR__/u','/__NEXTYEAR__/u' ); + $values=array( date('j'), $langs->trans(date('l')), + $langs->trans(date('n')), $langs->trans(date('M')), $langs->trans(date('F')), + $langs->trans(date('n', $nextMonth)), $langs->trans(date('M', $nextMonth)), $langs->trans(date('F', $nextMonth)), + date('Y'), date('Y', strtotime('+1 year')) ); $text=preg_replace($patterns, $values, $text);