[rt-users] Assigning HeldBy users during Asset Import

Kevin Falcone falcone at bestpractical.com
Wed Sep 17 16:03:49 EDT 2014


On Wed, Sep 17, 2014 at 02:27:57PM -0400, Mitch Kyser wrote:
> Thanks for the response.  I took a look at /opt/rt4/local/plugins/
> RT-Extension-Assets-Import-CSV/lib/RT/Extension/Assets/Import/[1]CSV.PM and
> removed the check you suggested by commenting out lines 64 thru 67;
> 
> #if ( not RT::Asset->Role($fieldname)->{Single}) {
> #    RT->Logger->warning( "Role name $fieldname must be single-value for
> "._column($field2csv->{$fieldname}).", skipping");
> #    delete $field2csv->{$fieldname};
> #}
> 
> Instead of the single warning I got one for each asset I tried to update that
> had a username to be placed in the HeldBy field;
> 
> [error]: Failed to set HeldBy to mkyser for row 5408: No valid Type specified
> (/opt/rt4/local/plugins/RT-Extension-Assets-Import-CSV/lib/RT/Extension/Assets/
> Import/CSV.pm:178)
> 
> When I tried using 'Owner' instead of 'HeldBy' I got the same results.

Try applying the change from the attached patch

> I will see what it takes to submit a bug report like you suggested, then submit
> one.

I moved your bug report into the assets queue (rather than the general
RT queue).

> I am seeing similar things when I try to use the Bulk Update feature with
> HeldBy, no error message but no change in HeldBy either.

This should be a separate bug report.

-kevin
-------------- next part --------------
diff --git a/lib/RT/Extension/Assets/Import/CSV.pm b/lib/RT/Extension/Assets/Import/CSV.pm
index 250b7e4..5f71a92 100644
--- a/lib/RT/Extension/Assets/Import/CSV.pm
+++ b/lib/RT/Extension/Assets/Import/CSV.pm
@@ -174,7 +174,7 @@ sub run {
                     next if $asset->RoleGroup($field)->HasMember( $user->PrincipalId );
 
                     $changes++;
-                    my ($ok, $msg) = $asset->AddRoleMember( PrincipalId => $user->PrincipalId );
+                    my ($ok, $msg) = $asset->AddRoleMember( PrincipalId => $user->PrincipalId, Type => $field );
                     unless ($ok) {
                         RT->Logger->error("Failed to set $field to $value for row $i: $msg");
                     }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 221 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20140917/1d2dd096/attachment.sig>


More information about the rt-users mailing list