Open joebordes opened 6 years ago
I gave this a shot after adding more supported closing characters and it seems impossible to get it done without breaking some case or another.
This is the state I had it in when I abandoned the idea:
diff --git a/modules/com_vtiger_workflow/VTSimpleTemplate.inc b/modules/com_vtiger_workflow/VTSimpleTemplate.inc
index f2b840d78..dc18889eb 100644
--- a/modules/com_vtiger_workflow/VTSimpleTemplate.inc
+++ b/modules/com_vtiger_workflow/VTSimpleTemplate.inc
@@ -307,10 +307,15 @@ class VTSimpleTemplate {
$current_user = new Users();
$current_user->retrieveCurrentUserInfoFromFile($assigned_user_id);
$return = preg_replace_callback(
- '/\\$(\w+?|\(general : \(__WorkflowFunction__\) (.+?) \)[ |&._\-\]}<>\/!"%ºª?,;]|\((\w+) : \(([_\w]+)\) (.+)\))/U',
+ '/\\$(\(general : \(__WorkflowFunction__\) (.+) \)[ |&._\-\]}<>\/!"%ºª?,;])/',
array($this, 'matchHandler'),
$this->template
);
+ $return = preg_replace_callback(
+ '/\\$(\w+?|\((\w+) : \(([_\w]+)\) (.+)\))/U',
+ array($this, 'matchHandler'),
+ $return
+ );
$current_user = $backCurrentUser;
return $return;
}
Unless someone can find the right regular expression I am thinking that we should completely change the placeholder to something like:
[__WFF__|workflow expression here|__FFW__]
that would require a changeset to change all existing templates
If we put two WorkflowFunction directives in the same line in an email they fail. I added a test case that proves this.
We must uncomment the test and modify the regular expressions in the workflow system to accept this case without breaking any of the other cases.
Ideally, I would like to see some additional tests added.
https://discussions.corebos.org/showthread.php?tid=723