Display error if there is only 1 autoFill param

This commit is contained in:
Deon George 2009-07-11 10:19:30 +10:00
parent 4eed1d8982
commit 0d71a96e34

View File

@ -994,6 +994,15 @@ class Template extends xmlTemplate {
U: Make the result upper case. U: Make the result upper case.
*/ */
case 'autoFill': case 'autoFill':
if (! preg_match('/;/',$arg)) {
system_message(array(
'title'=>_('Problem with autoFill() in template'),
'body'=>sprintf('%s (<b>%s</b>)',_('There is only 1 argument, when there should be two'),$attribute->getName(false)),
'type'=>'warn'));
return;
}
list($attr,$string) = preg_split('(([^,]+);(.*))',$arg,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); list($attr,$string) = preg_split('(([^,]+);(.*))',$arg,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
preg_match_all('/%(\w+)(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?%/U',$string,$matchall); preg_match_all('/%(\w+)(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?%/U',$string,$matchall);
//print"<PRE>";print_r($matchall); //0 = highlevel match, 1 = attr, 2 = subst, 3 = mod //print"<PRE>";print_r($matchall); //0 = highlevel match, 1 = attr, 2 = subst, 3 = mod