Skip to content

Commit

Permalink
Merge branch 'add-told-field'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Crome committed Sep 27, 2024
2 parents 2d06b98 + 50f4a1c commit d840a0f
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions lib/RT/Extension/Import/CSV.pm
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ sub _run_tickets {
} elsif ($fieldname =~ /^(id|Creator|LastUpdated|Created|Queue|Requestor|Cc|AdminCc|SquelchMailTo|Type|Owner|
Subject|Priority|InitialPriority|FinalPriority|Status|TimeEstimated|TimeWorked|TimeLeft|Starts|Due|MIMEObj|
Comment|Correspond|MemberOf|Parents|Parent|Members|Member|Children|Child|HasMember|RefersTo|ReferredToBy|
DependsOn|DependedOnBy)$/x) {
DependsOn|DependedOnBy|Told)$/x) {
# no-op, these are fine
} else {
$RT::Logger->warning(
Expand Down Expand Up @@ -878,6 +878,15 @@ sub _run_tickets {
}
}

my $told = delete( $args{Told} );
if( $told ) {
my $date = RT::Date->new( RT->SystemUser );
$date->Set( Format => 'unknown', Value => $told );
if ( !$date->Unix ) {
RT->Logger->error("Told '$told' is not valid, creating without it");
}
}

my $status = delete( $args{Status} );
if ( $status && !$default_queue->LifecycleObj->IsValid($status) ) {
if ($force) {
Expand Down Expand Up @@ -911,7 +920,6 @@ sub _run_tickets {
}

my ($ok, $txnobj, $msg) = $ticket->Create( %args );

if ($ok) {
$created++;
} else {
Expand All @@ -921,6 +929,13 @@ sub _run_tickets {
next ROW;
}

if( $told ) {
my $date = RT::Date->new( RT->SystemUser );
$date->Set( Format => 'unknown', Value => $told );
($ok, $msg) = $ticket->__Set( Field => 'Told', Value => $date->ISO );
$RT::Logger->error("Failed to set Told on ticket: $msg") unless $ok;
}

if ($status && $status ne $ticket->Status) {
($ok, $msg) = $ticket->__Set(Field => 'Status', Value => $status);
$RT::Logger->error("Failed to set Status on ticket: $msg") unless $ok
Expand Down

0 comments on commit d840a0f

Please sign in to comment.