Commit 87a75f13 authored by Thomas Sibley's avatar Thomas Sibley
Browse files

Allow 0 as a valid object CF value

parent 2ac27009
......@@ -876,7 +876,13 @@ sub update_object_custom_field_values {
map { scalar $args{ldap_entry}->get_value($_) }
@attributes;
if (($obj->FirstCustomFieldValue($cf_name) || '') eq ($value || '')) {
my $current = $obj->FirstCustomFieldValue($cf_name);
if (not defined $current and not defined $value) {
$self->_debug($obj->Name . ": Skipping '$cf_name'. No value in RT or LDAP.");
next;
}
elsif (defined $current and defined $value and $current eq $value) {
$self->_debug($obj->Name . ": Value '$value' is already set for '$cf_name'");
next;
}
......
......@@ -34,7 +34,7 @@ ok( my $server = Net::LDAP::Server::Test->new( $ldap_port, auto_schema => 1 ),
my $ldap = Net::LDAP->new("localhost:$ldap_port");
$ldap->bind();
my @ldap_entries;
for ( 1 .. 13 ) {
for ( 0 .. 12 ) {
my $username = "testuser$_";
my $dn = "uid=$username,ou=foo,dc=bestpractical,dc=com";
my $entry = {
......@@ -78,7 +78,7 @@ for my $entry (@ldap_entries) {
Name => $entry->{uid} );
ok($user->Id, "Found $entry->{cn} as ".$user->Id);
ok(!$user->Privileged, "User created as Unprivileged");
is($user->FirstCustomFieldValue('Employee Number'), $entry->{employeeId}, "cf is good");
is($user->FirstCustomFieldValue('Employee Number'), $entry->{employeeId}, "cf is good: $entry->{employeeId}");
}
# import again, check that it was cleared
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment