fixed addressbook prefs for customfields:

- customfields could not be saved if the name contained eg. upper case letters
- using the user-defined title from the field and not generate one from the name
This commit is contained in:
Ralf Becker 2006-03-04 12:34:35 +00:00
parent 52863057ec
commit 785a3e18c6

View File

@ -1204,7 +1204,7 @@
// while(list($x,$y) = @each($custom)) // while(list($x,$y) = @each($custom))
foreach($custom as $x => $y) foreach($custom as $x => $y)
{ {
$customfields[$y['name']] = $y['name']; $customfields[$y['name']] = $y['title'];
} }
$qfields = $this->bo->stock_contact_fields + $this->extrafields + $customfields; $qfields = $this->bo->stock_contact_fields + $this->extrafields + $customfields;
@ -1284,16 +1284,14 @@
'; ';
$tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color);
$i = 0; $i = 0;
while(list($cf) = each($customfields)) foreach($customfields as $name => $title)
{ {
if(!($i % 6)) if(!($i % 6))
{ {
$custom_var .= "\n <tr bgcolor='$tr_color'>\n"; $custom_var .= "\n <tr bgcolor='$tr_color'>\n";
} }
$custom_var .= ' <td><input type="checkbox" name="prefs[' $custom_var .= ' <td><input type="checkbox" name="prefs['.htmlspecialchars($name).']"'
. strtolower($cf) . ']"' . ($this->prefs[$name] ? ' checked' : ''). ' />' . htmlspecialchars($title) . '</td>' . "\n";
. ($this->prefs[$cf] ? ' checked' : '')
. '>' . str_replace('_',' ',$cf) . '</option></td>' . "\n";
if(!(++$i % 6)) if(!(++$i % 6))
{ {