Skip to content

Commit

Permalink
Download Spreadsheet uses 'Catalogue', support that.
Browse files Browse the repository at this point in the history
  • Loading branch information
puck committed Jul 24, 2022
1 parent 92a85c6 commit ec3d2e0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/RT/Extension/Assets/Import/CSV.pm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ sub run {
"Missing custom field $cfname for "._column($field2csv->{$fieldname}).", skipping");
delete $field2csv->{$fieldname};
}
} elsif ($fieldname =~ /^(id|Name|Status|Description|Catalog|Created|LastUpdated)$/) {
} elsif ($fieldname =~ /^(id|Name|Status|Description|Catalog|Catalogue|Created|LastUpdated)$/) {
# no-op, these are fine
} elsif ( RT::Asset->HasRole($fieldname) ) {
# no-op, roles are fine
Expand Down Expand Up @@ -169,15 +169,17 @@ sub run {
# Manage roles linkg to principals.
process_roles_field(\%args, $asset, $i, $field, $value, \$changes);
} else {
if ($field eq "Catalog") {
my $method = $field;
if ($field =~ "Catalog(ue)?") {
my $catalog = RT::Catalog->new( $args{CurrentUser} );
$catalog->Load( $value );
$value = $catalog->id;
$method = 'Catalog';
}

if ($asset->$field ne $value) {
if ($asset->$method ne $value) {
$changes++;
my $method = "Set" . $field;
$method = "Set" . $method;
my ($ok, $msg) = $asset->$method( $value );
unless ($ok) {
RT->Logger->error("Failed to set $field to $value for row $i: $msg");
Expand Down

0 comments on commit ec3d2e0

Please sign in to comment.