Allow custom fields in IF placeholders

This commit is contained in:
Hadi Nategh 2015-10-09 09:07:50 +00:00
parent 4b96ba9016
commit 06cbe1f0b0

View File

@ -1328,19 +1328,19 @@ abstract class bo_merge
if (strpos($content,'$$IF') !== false) if (strpos($content,'$$IF') !== false)
{ //Example use to use: $$IF n_prefix~Herr~Sehr geehrter~Sehr geehrte$$ { //Example use to use: $$IF n_prefix~Herr~Sehr geehrter~Sehr geehrte$$
$this->replacements =& $replacements; $this->replacements =& $replacements;
$content = preg_replace_callback('/\$\$IF ([0-9a-z_\/-]+)~(.*)~(.*)~(.*)\$\$/imU',Array($this,'replace_callback'),$content); $content = preg_replace_callback('/\$\$IF ([#0-9a-z_\/-]+)~(.*)~(.*)~(.*)\$\$/imU',Array($this,'replace_callback'),$content);
unset($this->replacements); unset($this->replacements);
} }
if (strpos($content,'$$NELF') !== false) if (strpos($content,'$$NELF') !== false)
{ //Example: $$NEPBR org_unit$$ sets a LF and value of org_unit, only if there is a value { //Example: $$NEPBR org_unit$$ sets a LF and value of org_unit, only if there is a value
$this->replacements =& $replacements; $this->replacements =& $replacements;
$content = preg_replace_callback('/\$\$NELF ([0-9a-z_\/-]+)\$\$/imU',Array($this,'replace_callback'),$content); $content = preg_replace_callback('/\$\$NELF ([#0-9a-z_\/-]+)\$\$/imU',Array($this,'replace_callback'),$content);
unset($this->replacements); unset($this->replacements);
} }
if (strpos($content,'$$NENVLF') !== false) if (strpos($content,'$$NENVLF') !== false)
{ //Example: $$NEPBRNV org_unit$$ sets only a LF if there is a value for org_units, but did not add any value { //Example: $$NEPBRNV org_unit$$ sets only a LF if there is a value for org_units, but did not add any value
$this->replacements =& $replacements; $this->replacements =& $replacements;
$content = preg_replace_callback('/\$\$NENVLF ([0-9a-z_\/-]+)\$\$/imU',Array($this,'replace_callback'),$content); $content = preg_replace_callback('/\$\$NENVLF ([#0-9a-z_\/-]+)\$\$/imU',Array($this,'replace_callback'),$content);
unset($this->replacements); unset($this->replacements);
} }
if (strpos($content,'$$LETTERPREFIX$$') !== false) if (strpos($content,'$$LETTERPREFIX$$') !== false)
@ -1351,7 +1351,7 @@ abstract class bo_merge
if (strpos($content,'$$LETTERPREFIXCUSTOM') !== false) if (strpos($content,'$$LETTERPREFIXCUSTOM') !== false)
{ //Example use to use for a custom Letter Prefix: $$LETTERPREFIX n_prefix title n_family$$ { //Example use to use for a custom Letter Prefix: $$LETTERPREFIX n_prefix title n_family$$
$this->replacements =& $replacements; $this->replacements =& $replacements;
$content = preg_replace_callback('/\$\$LETTERPREFIXCUSTOM ([0-9a-z_-]+)(.*)\$\$/imU',Array($this,'replace_callback'),$content); $content = preg_replace_callback('/\$\$LETTERPREFIXCUSTOM ([#0-9a-z_-]+)(.*)\$\$/imU',Array($this,'replace_callback'),$content);
unset($this->replacements); unset($this->replacements);
} }
return $content; return $content;