Skip to content

Commit 715fe92

Browse files
committed
Fix for template autoFill processing with "k" tokens, the attribute wasnt being selected to parse. Fixes #363
1 parent d90bc32 commit 715fe92

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

app/Classes/Template.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ private function autofill(string $arg): string
415415
preg_match_all('/(\d+)/',trim($match_subst),$substrarray);
416416

417417
$delimiter = ($match_delim === '') ? ' ' : preg_quote($match_delim);
418+
$result .= sprintf("%s = get_attribute('%s');\n",$match_attr,$match_attr);
418419
$result .= sprintf(" %s = %s.split('%s')[%s];\n",$match_attr,$match_attr,$delimiter,$substrarray[1][0] ?? '0');
419420

420421
} else {

templates/mail_account.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"title": "Generic: Mail Account",
3+
"description": "New Mail Account",
4+
"enabled": true,
5+
"icon": "fa-at",
6+
"rdn": "cn",
7+
"regexp": "/^ou=.+,?/",
8+
9+
"objectclasses": [
10+
"inetOrgPerson"
11+
],
12+
13+
"attributes": {
14+
"mail": {
15+
"display": "Email (mail)",
16+
"order": 1,
17+
"onchange": [
18+
"=autoFill(cn;%mail|0-0/k|@%)",
19+
"=autoFill(description;%mail|1-0/k|@%)"
20+
]
21+
},
22+
"givenName": {
23+
"display": "First Name",
24+
"onchange": [
25+
"=autoFill(cn;%givenName% %sn/U%)",
26+
"=autoFill(uid;%givenName|0-1/l%%sn/l%)"
27+
],
28+
"order": 3
29+
},
30+
"sn": {
31+
"display": "Last Name",
32+
"onchange": [
33+
"=autoFill(cn;%givenName% %sn/U%)",
34+
"=autoFill(uid;%givenName|0-1/l%%sn/l%)"
35+
],
36+
"order": 4
37+
},
38+
"cn": {
39+
"display": "Common Name",
40+
"readonly": true,
41+
"order": 2
42+
},
43+
"description": {
44+
"display": "Description",
45+
"order": 5
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)