[Rt-commit] rt branch, 4.4/download-user-info, created. rt-4.4.2-249-g1e830b0f1
Craig Kaiser
craig at bestpractical.com
Wed Nov 21 16:29:27 EST 2018
The branch, 4.4/download-user-info has been created
at 1e830b0f1283047c85b88e80c7eeaeac249ee589 (commit)
- Log -----------------------------------------------------------------
commit 0aad7cfc6c5114a65c67d7b8ac2f0ed57a9c81b7
Author: Craig Kaiser <craig at bestpractical.com>
Date: Thu Jun 14 15:51:40 2018 -0400
Add column to transaction column map for content
diff --git a/share/html/Elements/RT__Transaction/ColumnMap b/share/html/Elements/RT__Transaction/ColumnMap
index 28a82f1e0..bcf6e229c 100644
--- a/share/html/Elements/RT__Transaction/ColumnMap
+++ b/share/html/Elements/RT__Transaction/ColumnMap
@@ -105,6 +105,10 @@ my $COLUMN_MAP = {
}
},
},
+ Content => {
+ title => 'Content', # loc
+ value => sub { return $_[0]->Content },
+ },
};
commit 98e98599076bba8cd02b4a88584494c6e4788a6b
Author: Craig Kaiser <craig at bestpractical.com>
Date: Thu Jun 14 15:52:38 2018 -0400
Add config options for download user data result formats
Need three new config options that allow admins to specify the search
result formats for the user data downloads.
$UserTicketDataResultFormat
$UserDataResultFormat
$UserTransactionDataResultFormat
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 6fe7bc7a2..eb6f7bc81 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1382,6 +1382,38 @@ Set ($DefaultSearchResultFormat, qq{
'<small>__LastUpdatedRelative__</small>',
'<small>__TimeLeft__</small>'});
+
+=item C<$UserTicketDataResultFormat>
+
+This is the format of ticket search result for "Download User Tickets" links. It
+defaults to C<DefaultSearchResultFormat> if it's not set.
+
+=cut
+
+Set($UserTicketDataResultFormat, undef );
+
+=item C<$UserDataResultFormat>
+
+This is the format of the user search result for "Download User Data" links.
+
+=cut
+
+Set($UserDataResultFormat, "'__id__', '__Name__', '__EmailAddress__', '__RealName__',\
+ '__NickName__', '__Organization__', '__HomePhone__', '__WorkPhone__',\
+ '__MobilePhone__', '__PagerPhone__', '__Address1__', '__Address2__',\
+ '__City__', '__State__','__Zip__', '__Country__', '__Gecos__', '__Lang__',\
+ '__FreeFormContactInfo__'");
+
+=item C<$UserTransactionDataResultFormat>
+
+This is the format of the user transaction search result for "Download User Transaction Data" links.
+
+=cut
+
+Set($UserTransactionDataResultFormat, "'__ObjectId__', '__id__', '__Created__', '__Description__',\
+ '__OldValue__', '__NewValue__', '__Content__'");
+
+
=item C<$DefaultSearchResultOrderBy>
What Tickets column should we order by for RT Ticket search results.
commit 233bf58a09f42de47ebcc9c3a069e811631942fc
Author: Craig Kaiser <craig at bestpractical.com>
Date: Thu Jun 14 15:53:14 2018 -0400
Create helper for exporting user related information
Export transaction and user record information pertaining to the
provided user id, as a TSV file.
diff --git a/share/html/User/RelatedData.tsv b/share/html/User/RelatedData.tsv
new file mode 100644
index 000000000..25804686d
--- /dev/null
+++ b/share/html/User/RelatedData.tsv
@@ -0,0 +1,85 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
+%# <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<%ARGS>
+$PreserveNewLines => 0
+$Type => 'User'
+$Format => undef
+$id
+</%ARGS>
+
+<%INIT>
+# Abort unless supported type for export found
+Abort('Incorrect value passed for Type') unless
+ $Type && ( $Type eq 'User' || $Type eq 'Transaction');
+
+if ( $session{'CurrentUser'}->id ne $id ) {
+ Abort('User does not have the right to view other users') unless
+ $session{'CurrentUser'}->UserObj->HasRight( Object => $RT::System, Right =>'AdminUsers');
+}
+
+my $Collection;
+
+if ( $Type eq 'User' ) {
+ $Format = RT->Config->Get('UserDataResultFormat') unless $Format;
+
+ $Collection = RT::Users->new( $session{'CurrentUser'} );
+ $Collection->Limit( FIELD => 'id', VALUE => $id );
+
+} elsif ( $Type eq 'Transaction' ) {
+ $Format = RT->Config->Get('UserTransactionDataResultFormat') unless $Format;
+
+ $Collection = RT::Transactions->new( $session{'CurrentUser'} );
+ $Collection->Limit( FIELD => 'ObjectType', VALUE => 'RT::Ticket' );
+ $Collection->Limit( FIELD => 'Creator', VALUE => $id );
+ $Collection->Limit( FIELD => 'Type', VALUE => 'Create' );
+ $Collection->Limit( FIELD => 'Type', VALUE => 'Correspond' );
+ $Collection->Limit( FIELD => 'Type', VALUE => 'Comment' );
+}
+
+$m->comp( "/Elements/TSVExport", Collection => $Collection, Format => $Format, PreserveNewLines => $PreserveNewLines );
+</%INIT>
commit ac2bfaec7e2861ea92489b9b5a24a07f10edfc2c
Author: Craig Kaiser <craig at bestpractical.com>
Date: Thu Jun 14 15:53:45 2018 -0400
Create portlet for downloading user information
Provide three links for downloading user information as a tsv file:
User record data
User transaction data
User ticket data
diff --git a/share/html/User/Elements/RelatedData b/share/html/User/Elements/RelatedData
new file mode 100644
index 000000000..051112d96
--- /dev/null
+++ b/share/html/User/Elements/RelatedData
@@ -0,0 +1,69 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
+%# <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<&|/Widgets/TitleBox,
+ class => 'user-related-info',
+ title => loc("User related info"),
+&>
+
+<div>
+ <a href="/User/RelatedData.tsv?Type=User&id=<% $UserObj->id %>" class="button"><% $UserDataButton %></a>
+ <a href="/Search/Results.tsv?Query=Requestor.id=<% $UserObj->id %>&Format=<% $Format | un %>" class="button"><% $UserTicketsButton %></a>
+ <a href="/User/RelatedData.tsv?Type=Transaction&id=<% $UserObj->id %>" class="button"><% $UserTxnButton %></a>
+</div>
+</&>
+
+<%INIT>
+my $Format = RT->Config->Get('UserTicketDataResultFormat') || RT->Config->Get('DefaultSearchResultFormat');
+</%INIT>
+
+<%ARGS>
+$UserObj
+$UserDataButton => loc( 'Download User Data' )
+$UserTicketsButton => loc( 'Download User Tickets' )
+$UserTxnButton => loc( 'Download User Transaction Data' )
+</%ARGS>
commit e979213918c3754d3a8b7c2230a527fdbca1dc16
Author: Craig Kaiser <craig at bestpractical.com>
Date: Thu Jun 14 15:55:26 2018 -0400
Add user data download portlet to admin user modify page
diff --git a/share/html/Admin/Users/Modify.html b/share/html/Admin/Users/Modify.html
index 3b8bc42fc..5b3222d8a 100644
--- a/share/html/Admin/Users/Modify.html
+++ b/share/html/Admin/Users/Modify.html
@@ -232,6 +232,7 @@
% }
</form>
+<& /User/Elements/RelatedData, UserObj => $UserObj &>
<%INIT>
my $UserObj = RT::User->new($session{'CurrentUser'});
commit 110ee095a1d8b6c6524ceb34e2a7648a19634711
Author: Craig Kaiser <craig at bestpractical.com>
Date: Thu Jun 21 16:58:16 2018 -0400
Add download user data portlet to AboutMe.html page
diff --git a/share/html/Prefs/AboutMe.html b/share/html/Prefs/AboutMe.html
index 7eaf36755..3e2aa8245 100644
--- a/share/html/Prefs/AboutMe.html
+++ b/share/html/Prefs/AboutMe.html
@@ -201,6 +201,12 @@
</form>
+<& /User/Elements/RelatedData,
+ UserObj => $UserObj,
+ UserDataButton => loc( 'Download My Data' ),
+ UserTicketsButton => loc( 'Download My Tickets' ),
+ UserTxnButton => loc( 'Download My Transaction Data' ),
+&>
<%INIT>
commit 0e35a975952f820e2a40f5a02f34af63488a6462
Author: Craig Kaiser <craig at bestpractical.com>
Date: Wed Nov 21 14:35:37 2018 -0500
Add user download component to self service
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index eb6f7bc81..020044cea 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1386,7 +1386,8 @@ Set ($DefaultSearchResultFormat, qq{
=item C<$UserTicketDataResultFormat>
This is the format of ticket search result for "Download User Tickets" links. It
-defaults to C<DefaultSearchResultFormat> if it's not set.
+defaults to C<DefaultSearchResultFormat> for privileged users and C<DefaultSelfServiceSearchResultFormat>
+for unprivileged users if it's not set.
=cut
diff --git a/share/html/SelfService/Prefs.html b/share/html/SelfService/Prefs.html
index b4c57c0fc..85bfe786c 100644
--- a/share/html/SelfService/Prefs.html
+++ b/share/html/SelfService/Prefs.html
@@ -81,6 +81,7 @@
<& /Elements/Submit, Label => loc('Save Changes') &>
</form>
+<& /SelfService/User/Elements/RelatedData, UserObj => $user &>
<%INIT>
my @results;
diff --git a/share/html/SelfService/Search/Results.tsv b/share/html/SelfService/Search/Results.tsv
new file mode 100644
index 000000000..2af1a6344
--- /dev/null
+++ b/share/html/SelfService/Search/Results.tsv
@@ -0,0 +1,50 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
+%# <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<%INIT>
+$m->comp('/Search/Results.tsv', %ARGS);
+</%INIT>
diff --git a/share/html/SelfService/User/Elements/RelatedData b/share/html/SelfService/User/Elements/RelatedData
new file mode 100644
index 000000000..4ad2469cd
--- /dev/null
+++ b/share/html/SelfService/User/Elements/RelatedData
@@ -0,0 +1,69 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
+%# <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<&|/Widgets/TitleBox,
+ class => 'user-related-info',
+ title => loc("User related info"),
+&>
+
+<div>
+ <a href="/SelfService/User/RelatedData.tsv?Type=User&id=<% $UserObj->id %>" class="button"><% $UserDataButton %></a>
+ <a href="/SelfService/Search/Results.tsv?Query=Requestor.id=<% $UserObj->id %>&Format=<% $Format | un %>" class="button"><% $UserTicketsButton %></a>
+ <a href="/SelfService/User/RelatedData.tsv?Type=Transaction&id=<% $UserObj->id %>" class="button"><% $UserTxnButton %></a>
+</div>
+</&>
+
+<%INIT>
+my $Format = RT->Config->Get('UserTicketDataResultFormat') || RT->Config->Get('DefaultSelfServiceSearchResultFormat');
+</%INIT>
+
+<%ARGS>
+$UserObj
+$UserDataButton => loc( 'Download My Data' )
+$UserTicketsButton => loc( 'Download My Tickets' )
+$UserTxnButton => loc( 'Download My Transaction Data' )
+</%ARGS>
diff --git a/share/html/SelfService/User/RelatedData.tsv b/share/html/SelfService/User/RelatedData.tsv
new file mode 100644
index 000000000..e0222e11c
--- /dev/null
+++ b/share/html/SelfService/User/RelatedData.tsv
@@ -0,0 +1,50 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
+%# <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<%INIT>
+$m->comp('/User/RelatedData.tsv', %ARGS);
+</%INIT>
commit 1ffa68e2d0bc20c19f70f15c28de39d9a0296f5b
Author: Craig Kaiser <craig at bestpractical.com>
Date: Wed Nov 21 16:25:09 2018 -0500
Config option to allow self service users to download their user data
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 020044cea..2189640ba 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1831,6 +1831,16 @@ access ticked displays.
Set($SelfServiceRegex, qr!^(?:/+SelfService/)!x );
+=item C<$SelfServiceDownloadUserData>
+
+Allow Self Service users to download their user information, ticket data
+and transaction data as a .tsv file. When enabled, these three options
+will appear on the /SelfService/Prefs.html page.
+
+=cut
+
+Set( $SelfServiceDownloadUserData, 0 );
+
=back
=head2 Articles
diff --git a/share/html/SelfService/Prefs.html b/share/html/SelfService/Prefs.html
index 85bfe786c..67beedb48 100644
--- a/share/html/SelfService/Prefs.html
+++ b/share/html/SelfService/Prefs.html
@@ -81,7 +81,9 @@
<& /Elements/Submit, Label => loc('Save Changes') &>
</form>
+% if( RT->Config->Get('SelfServiceDownloadData') ) {
<& /SelfService/User/Elements/RelatedData, UserObj => $user &>
+% }
<%INIT>
my @results;
commit 1e830b0f1283047c85b88e80c7eeaeac249ee589
Author: Craig Kaiser <craig at bestpractical.com>
Date: Thu Jun 14 15:56:19 2018 -0400
Create test for user information TSV download
Create tests to test the user personal identifying information download
features.
diff --git a/t/web/download_user_info.t b/t/web/download_user_info.t
new file mode 100644
index 000000000..cc100d686
--- /dev/null
+++ b/t/web/download_user_info.t
@@ -0,0 +1,85 @@
+
+use strict;
+use warnings;
+
+use RT::Test tests => undef;
+
+RT->Config->Set( UserTicketDataResultFormat =>
+ "'__id__', '__Subject__', '__Status__', '__QueueName__', '__Owner__', '__Priority__', '__Requestors__'"
+);
+
+my ( $baseurl, $agent ) = RT::Test->started_ok;
+my $url = $agent->rt_base_url;
+
+# Login
+$agent->login( 'root' => 'password' );
+
+{
+ my $root = RT::Test->load_or_create_user( Name => 'root' );
+ ok $root && $root->id;
+
+# We want transactions attached to our user, so not using test method for ticket create
+ my $ticket = RT::Ticket->new($root);
+ $ticket->Create(
+ Subject => 'Test',
+ Requestor => 'root',
+ Queue => 'General'
+ );
+ my $id = $ticket->id;
+ ok $id;
+
+ $ticket->Comment( Content => 'Test - Comment' );
+ $ticket->Correspond( Content => 'Test - Reply' );
+
+ my @dates;
+ my $trans = $ticket->Transactions;
+
+ while ( my $tran = $trans->Next ) {
+ if ( $tran->Type =~ /Create|Comment|Correspond/ ) {
+ push @dates, $tran->CreatedObj->AsString;
+ }
+ }
+ my ( $date_created, $date_commented, $date_correspondence ) = @dates;
+
+ # Make sure we have the expected amount of transactions
+ is scalar @dates, 3;
+
+ # TSV file for user record information
+ $agent->get_ok( $url . "Admin/Users/Modify.html?id=" . $root->id );
+ $agent->follow_link_ok( { text => 'Download User Data' } );
+
+ my $user_info_tsv = <<EOF;
+id\tName\tEmailAddress\tRealName\tNickName\tOrganization\tHomePhone\tWorkPhone\tMobilePhone\tPagerPhone\tAddress1\tAddress2\tCity\tState\tZip\tCountry\tGecos\tLang\tFreeFormContactInfo
+14\troot\troot\@localhost\tEnoch Root\t\t\t\t\t\t\t\t\t\t\t\t\troot\t\t
+EOF
+
+ is $agent->content, $user_info_tsv,
+ "User record information downloaded correctly";
+
+ # TSV file for Transactions
+ $agent->get_ok( $url . "Admin/Users/Modify.html?id=" . $root->id );
+ $agent->follow_link_ok( { text => 'Download User Transaction Data' } );
+
+ my $transaction_info_tsv = <<EOF;
+ObjectId\tid\tCreated\tDescription\tOldValue\tNewValue\tContent
+1\t30\t$date_created\tTicket created\t\t\tThis transaction appears to have no content
+1\t32\t$date_commented\tComments added\t\t\tTest - Comment
+1\t33\t$date_correspondence\tCorrespondence added\t\t\tTest - Reply
+EOF
+
+ is $agent->content, $transaction_info_tsv,
+ "User transaction information downloaded correctly";
+
+ # TSV file for user's Tickets
+ $agent->get_ok( $url . "Admin/Users/Modify.html?id=" . $root->id );
+ $agent->follow_link_ok( { text => 'Download User Tickets' } );
+
+ my $ticket_info_tsv = <<EOF;
+id\tSubject\tStatus\tQueueName\tOwner\tPriority\tRequestors
+1\tTest\topen\tGeneral\tNobody in particular\t0\troot (Enoch Root)
+EOF
+
+ is $agent->content, $ticket_info_tsv, "User tickets downloaded correctly";
+}
+
+done_testing();
-----------------------------------------------------------------------
More information about the rt-commit
mailing list