.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "RT::Extension::Assets::Import::CSV 3pm" .TH RT::Extension::Assets::Import::CSV 3pm "2023-02-25" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" RT\-Extension\-Assets\-Import\-CSV \- RT Assets Import from CSV .SH "PREREQUISITES" .IX Header "PREREQUISITES" This version of RT::Extension::Assets::Import::CSV requires \s-1RT 4.4,\s0 as that version of \s-1RT\s0 has Assets built in. .PP If you're running \s-1RT 4.2\s0 with the Assets extension, you should seek an older version of this extension; specifically, version 1.4. .SH "INSTALLATION" .IX Header "INSTALLATION" .ie n .IP """perl Makefile.PL""" 4 .el .IP "\f(CWperl Makefile.PL\fR" 4 .IX Item "perl Makefile.PL" .PD 0 .ie n .IP """make""" 4 .el .IP "\f(CWmake\fR" 4 .IX Item "make" .ie n .IP """make install""" 4 .el .IP "\f(CWmake install\fR" 4 .IX Item "make install" .PD May need root permissions .IP "Edit your \fI/opt/rt5/etc/RT_SiteConfig.pm\fR" 4 .IX Item "Edit your /opt/rt5/etc/RT_SiteConfig.pm" Add this line: .Sp .Vb 1 \& Plugin(\*(AqRT::Extension::Assets::Import::CSV\*(Aq); .Ve .Sp See \*(L"\s-1CONFIGURATION\*(R"\s0, below, for the remainder of the required configuration. .IP "Restart your webserver" 4 .IX Item "Restart your webserver" .PD 0 .ie n .IP "Run ""bin/rt\-assets\-import\-csv""" 4 .el .IP "Run \f(CWbin/rt\-assets\-import\-csv\fR" 4 .IX Item "Run bin/rt-assets-import-csv" .PD See \f(CW\*(C`bin/rt\-assets\-import\-csv \-\-help\*(C'\fR for more information. .SH "CONFIGURATION" .IX Header "CONFIGURATION" The following configuration would be used to import a three-column \s-1CSV\s0 of assets, where the column titled \f(CW\*(C`serviceTag\*(C'\fR is unique: .PP .Vb 7 \& Set( $AssetsImportUniqueCF, \*(AqService Tag\*(Aq ); \& Set( %AssetsImportFieldMapping, \& \*(AqName\*(Aq => \*(Aqdescription\*(Aq, \& \*(AqCF.Service Tag\*(Aq => \*(AqserviceTag\*(Aq, \& \*(AqCF.Location\*(Aq => \*(Aqbuilding\*(Aq, \& \*(AqCF.Serial #\*(Aq => \*(AqserialNo\*(Aq, \& ); .Ve .SS "Constant values" .IX Subsection "Constant values" If you want to set an \s-1RT\s0 column or custom field to a static value for all imported assets, precede the \*(L"\s-1CSV\s0 field name\*(R" (right hand side of the mapping) with a slash, like so: .PP .Vb 8 \& Set( $AssetsImportUniqueCF, \*(AqService Tag\*(Aq ); \& Set( %AssetsImportFieldMapping, \& \*(AqName\*(Aq => \*(Aqdescription\*(Aq, \& \*(AqCatalog\*(Aq => \e\*(AqHardware\*(Aq, \& \*(AqCF.Service Tag\*(Aq => \*(AqserviceTag\*(Aq, \& \*(AqCF.Location\*(Aq => \*(Aqbuilding\*(Aq, \& \*(AqCF.Serial #\*(Aq => \*(AqserialNo\*(Aq, \& ); .Ve .PP Every imported asset will now be added to the Hardware catalog in \s-1RT.\s0 This feature is particularly useful for setting the asset catalog, but may also be useful when importing assets from \s-1CSV\s0 sources you don't control (and don't want to modify each time). .SS "Computed values" .IX Subsection "Computed values" You may also compute values during import, by passing a subroutine reference as the value in the \f(CW%AssetsImportFieldMapping\fR. This subroutine will be called with a hash reference of the parsed \s-1CSV\s0 row. .PP .Vb 7 \& Set( $AssetsImportUniqueCF, \*(AqService Tag\*(Aq ); \& Set( %AssetsImportFieldMapping, \& \*(AqName\*(Aq => \*(Aqdescription\*(Aq, \& \*(AqCF.Service Tag\*(Aq => \*(AqserviceTag\*(Aq, \& \*(AqCF.Location\*(Aq => \*(Aqbuilding\*(Aq, \& \*(AqCF.Weight\*(Aq => sub { $_[0]\->{"Weight (kg)"} || "(unknown)" }, \& ); .Ve .PP Using computed columns may cause false-positive \*(L"unused column\*(R" warnings; these can be ignored. .SS "Numeric identifiers" .IX Subsection "Numeric identifiers" If you are already using a numeric identifier to uniquely track your assets, and wish \s-1RT\s0 to take over handling of that identifier, you can choose to leave \f(CW$AssetsImportUniqueCF\fR unset, and assign to \f(CW\*(C`id\*(C'\fR in the \f(CW%AssetsImportFieldMapping\fR: .PP .Vb 6 \& Set( %AssetsImportFieldMapping, \& \*(Aqid\*(Aq => \*(AqserviceTag\*(Aq, \& \*(AqName\*(Aq => \*(Aqdescription\*(Aq, \& \*(AqCF.Service Tag\*(Aq => \*(AqserviceTag\*(Aq, \& \*(AqCF.Serial #\*(Aq => \*(AqserialNo\*(Aq, \& ); .Ve .PP This requires that, after the import, \s-1RT\s0 becomes the generator of all asset ids. Otherwise, asset id conflicts may occur. .SH "AUTHOR" .IX Header "AUTHOR" Best Practical Solutions, \s-1LLC\s0 .SH "BUGS" .IX Header "BUGS" All bugs should be reported via email to .PP .Vb 1 \& L .Ve .PP or via the web at .PP .Vb 1 \& L. .Ve .SH "COPYRIGHT" .IX Header "COPYRIGHT" This extension is Copyright (C) 2014\-2021 Best Practical Solutions, \s-1LLC.\s0 .PP This is free software, licensed under: .PP .Vb 1 \& The GNU General Public License, Version 2, June 1991 .Ve