Code: Select all
id int(11) NO PRI NULL auto_increment
login varchar(200) NO UNI NULL
pw varchar(64) NO NULL
title varchar(50) YES NULL
first_name varchar(100) NO NULL
last_name varchar(100) NO NULL
valid_id smallint(6) NO MUL NULL
create_time datetime NO NULL
create_by int(11) NO MUL NULL
change_time datetime NO NULL
change_by int(11) NO MUL NULL
User.pm
Code: Select all
$UserObject->UserUpdate(
UserID => 4321,
UserFirstname => 'Huber',
UserLastname => 'Manfred',
UserLogin => 'mhuber',
UserPw => 'some-pass', # not required
UserEmail => 'email@example.com',
ValidID => 1,
ChangeUserID => 123,
);
UserUpdate ignores (as far as I can tell) anything not here.
UserUpdate is
Code: Select all
return if !$Self->{DBObject}->Do(
SQL => "UPDATE $Self->{UserTable} SET title = ?, first_name = ?, last_name = ?, "
. " $Self->{UserTableUser} = ?, valid_id = ?, "
. " change_time = current_timestamp, change_by = ? "
. " WHERE $Self->{UserTableUserID} = ?",
Bind => [
\$Param{UserTitle}, \$Param{UserFirstname}, \$Param{UserLastname},
\$Param{UserLogin}, \$Param{ValidID}, \$Param{ChangeUserID}, \$Param{UserID},
],
);
which leaves nothing to be updated, *BUT* if you altered the table and vetted the content, you could throw it in here.
ALTER TABLE `users` ADD `phone` VARCHAR( 50 ) NOT NULL;
modify Kernel/System/User.pm UserUpdate (around line 470)
Code: Select all
unless ($Param{UserPhone}) { $Param{UserPhone} ='' };
return if !$Self->{DBObject}->Do(
SQL => "UPDATE $Self->{UserTable} SET title = ?, first_name = ?, last_name = ?, "
. " $Self->{UserTableUser} = ?, phone = ?, valid_id = ?, "
. " change_time = current_timestamp, change_by = ? "
. " WHERE $Self->{UserTableUserID} = ?",
Bind => [
\$Param{UserTitle}, \$Param{UserFirstname}, \$Param{UserLastname},
\$Param{UserLogin}, \$Param{UserPhone}, \$Param{ValidID}, \$Param{ChangeUserID}, \$Param{UserID},
],
);
and you might check out UserAdd around Line 353
Code: Select all
# sql
unless ($Param{UserPhone}) { $Param{UserPhone} ='' };
return if !$Self->{DBObject}->Do(
SQL => "INSERT INTO $Self->{UserTable} "
. "(title, first_name, last_name, "
. " $Self->{UserTableUser}, $Self->{UserTableUserPW}, "
. " valid_id, create_time, create_by, change_time, change_by, phone)"
. " VALUES "
. " (?, ?, ?, ?, ?, ?, current_timestamp, ?, current_timestamp, ?)",
Bind => [
\$Param{UserTitle}, \$Param{UserFirstname}, \$Param{UserLastname},
\$Param{UserLogin}, \$Param{UserPw}, \$Param{ValidID},
\$Param{ChangeUserID}, \$Param{ChangeUserID}, \$Param{UserPhone},
],
);
Now, I don't know if this will show up anywhere, but it sure will be in the database. You'll likely want to check out
Code: Select all
my $SQL = "SELECT $Self->{UserTableUserID}, $Self->{UserTableUser}, "
. " title, first_name, last_name, $Self->{UserTableUserPW}, valid_id, "
. " create_time, change_time, phone FROM $Self->{UserTable} WHERE ";
around line 192 (shown is modified)
and
Code: Select all
$Data{ChangeTime} = $Row[8];
$Data{UserPhone} =$Row[9];
}
around line 213
This is a first blush guess. Backup before you do things. This code is not tested, may break, and definitely will not survive updates. Please test and relate your findings. (oh, and you'll likely need to change dtls and places you want to actually *show* this data, but otherwise...)