[rt-users] Queue Advanced Format
Some of our users see a different list query format then others. If you open a Queue and click Advanced, you see a textarea labelled "Format" The content of this textarea is identical with the value of $DefaultSearchResultFormat defined in etc/RT_SiteConfig.pm If I change the value in the web interface and click apply, then revisit the advanced setting, I see that the value has not been changed. Any idea what could be responsible for the change to not go through? regards david - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Los Angeles - January 9-11 2017
Re: [rt-users] Adding an Action link to Ticket/Display.html/BeforeActionList
well, here is one solution that works for me. my $referer = RT::Interface::Web::RequestENV('HTTP_REFERER'); https://github.com/MarkHofstetter/RT-Extension-OneClickClose On 12.10.2016 12:16, David Schmidt wrote: How can I access the referer in a callback? I managed to add the link using this callback: file: html/Callbacks/RT-Extension-OneClickClose/Elements/Tabs/Privileged <%ARGS> $Path => undef <%INIT> if ( $Path =~ m!^\/Ticket\/Display\.html! ) { if ( $DECODED_ARGS->{id} && $DECODED_ARGS->{id} =~ m/\d+/ ) { my $ticket_id = $DECODED_ARGS->{id}; my $actions = PageMenu()->child( 'actions' ); $actions->child( 'OneClickClose', title => 'OneClickClose', path => "/Ticket/Update.html?Status=resolved&SubmitTicket=1&id=$ticket_id&AfterSubmitReturn=1", ); } } On 06.10.2016 14:40, David Schmidt wrote: I'll answer myself: if an action is not a ref it is rendered in the result box. bit unexpected but im sure there is a reason. (code in share/html/Elements/ListActions) https://github.com/bestpractical/rt/blob/stable/share/html/Elements/ListActions#L49 On 06.10.2016 13:53, David Schmidt wrote: When/Where are the actions added to @Actions? 1) for some reason the \@Actions ArrayRef is empty when I access it in the callback. Where do the Actions come from? I am talking about the links "Reply", "Comment", "Forward", "Stall", ... 2) If I push a simple string to \@Actions they end up in a yellow "Results" Widget. see attached screenshot #local/plugins/RT-Extension-OneClickClose/html/Callbacks/RT-Extension-OneClickClose/Ticket/Display.html/BeforeActionList <%init> use Data::Dumper; $RT::Logger->debug("\n\n###\n".Dumper($Actions)."\n\n###\n"); push @$Actions, "foo"; <%args> $Actions => undef $TicketObj => undef Output: ### $VAR1 = []; ### (/opt/rt4/local/plugins/RT-Extension-OneClickClose/html/Callbacks/RT-Extension-OneClickClose/Ticket/Display.html/BeforeActionList:3) - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017 - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017 - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017 - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
Re: [rt-users] Adding an Action link to Ticket/Display.html/BeforeActionList
How can I access the referer in a callback? I managed to add the link using this callback: file: html/Callbacks/RT-Extension-OneClickClose/Elements/Tabs/Privileged <%ARGS> $Path => undef <%INIT> if ( $Path =~ m!^\/Ticket\/Display\.html! ) { if ( $DECODED_ARGS->{id} && $DECODED_ARGS->{id} =~ m/\d+/ ) { my $ticket_id = $DECODED_ARGS->{id}; my $actions = PageMenu()->child( 'actions' ); $actions->child( 'OneClickClose', title => 'OneClickClose', path => "/Ticket/Update.html?Status=resolved&SubmitTicket=1&id=$ticket_id&AfterSubmitReturn=1", ); } } On 06.10.2016 14:40, David Schmidt wrote: I'll answer myself: if an action is not a ref it is rendered in the result box. bit unexpected but im sure there is a reason. (code in share/html/Elements/ListActions) https://github.com/bestpractical/rt/blob/stable/share/html/Elements/ListActions#L49 On 06.10.2016 13:53, David Schmidt wrote: When/Where are the actions added to @Actions? 1) for some reason the \@Actions ArrayRef is empty when I access it in the callback. Where do the Actions come from? I am talking about the links "Reply", "Comment", "Forward", "Stall", ... 2) If I push a simple string to \@Actions they end up in a yellow "Results" Widget. see attached screenshot #local/plugins/RT-Extension-OneClickClose/html/Callbacks/RT-Extension-OneClickClose/Ticket/Display.html/BeforeActionList <%init> use Data::Dumper; $RT::Logger->debug("\n\n###\n".Dumper($Actions)."\n\n###\n"); push @$Actions, "foo"; <%args> $Actions => undef $TicketObj => undef Output: ### $VAR1 = []; ### (/opt/rt4/local/plugins/RT-Extension-OneClickClose/html/Callbacks/RT-Extension-OneClickClose/Ticket/Display.html/BeforeActionList:3) - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017 - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017 - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
Re: [rt-users] Adding an Action link to Ticket/Display.html/BeforeActionList
I'll answer myself: if an action is not a ref it is rendered in the result box. bit unexpected but im sure there is a reason. (code in share/html/Elements/ListActions) https://github.com/bestpractical/rt/blob/stable/share/html/Elements/ListActions#L49 On 06.10.2016 13:53, David Schmidt wrote: When/Where are the actions added to @Actions? 1) for some reason the \@Actions ArrayRef is empty when I access it in the callback. Where do the Actions come from? I am talking about the links "Reply", "Comment", "Forward", "Stall", ... 2) If I push a simple string to \@Actions they end up in a yellow "Results" Widget. see attached screenshot #local/plugins/RT-Extension-OneClickClose/html/Callbacks/RT-Extension-OneClickClose/Ticket/Display.html/BeforeActionList <%init> use Data::Dumper; $RT::Logger->debug("\n\n###\n".Dumper($Actions)."\n\n###\n"); push @$Actions, "foo"; <%args> $Actions => undef $TicketObj => undef Output: ### $VAR1 = []; ### (/opt/rt4/local/plugins/RT-Extension-OneClickClose/html/Callbacks/RT-Extension-OneClickClose/Ticket/Display.html/BeforeActionList:3) - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017 - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
[rt-users] Adding an Action link to Ticket/Display.html/BeforeActionList
When/Where are the actions added to @Actions? 1) for some reason the \@Actions ArrayRef is empty when I access it in the callback. Where do the Actions come from? I am talking about the links "Reply", "Comment", "Forward", "Stall", ... 2) If I push a simple string to \@Actions they end up in a yellow "Results" Widget. see attached screenshot #local/plugins/RT-Extension-OneClickClose/html/Callbacks/RT-Extension-OneClickClose/Ticket/Display.html/BeforeActionList <%init> use Data::Dumper; $RT::Logger->debug("\n\n###\n".Dumper($Actions)."\n\n###\n"); push @$Actions, "foo"; <%args> $Actions => undef $TicketObj => undef Output: ### $VAR1 = []; ### (/opt/rt4/local/plugins/RT-Extension-OneClickClose/html/Callbacks/RT-Extension-OneClickClose/Ticket/Display.html/BeforeActionList:3) - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
[rt-users] show msg to user in scrip
Hello list I want to write a scrip that aborts the action the user is trying to commit and redisplay the current page with an added info message. How can i display an info message to the user? regards david - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
Re: [rt-users] "On Reply" set ticket status to "resolved"
Hello Nilesh and thank you for your reply. Your advice would have been helpful if I hadnt looked for documentation before. Which I did. I am wildly searching for information using random search parameters instead of following a tutorial of some sort. Is there any? Luckily I found what I needed in another rt-users email. Here is my solution: === Admin > Scrips > Create Description: OnCorrespondSetResolved Condition: On Correspond Action: User Defined Template: Blank Custom Condition: #leave empty Custom action preparation code: return 1; Custom action commit code: my ($status, $msg) = $self->TicketObj->SetStatus("resolved"); unless ( $status ) { $RT::Logger->error("Couldn't change status: $msg"); return 0; } return 1; == On 05.10.2016 03:13, Nilesh wrote: You can write a simple scrip with a pre commit action to change the TicketObj status. See the api docs. -- Nilesh On 04-Oct-2016 5:22 PM, "David Schmidt" wrote: Hello list, I would like to set a tickets status to "resolved" on reply. The wiki mentions a "On Reply" action that I cannot find in my rt instance. https://rt-wiki.bestpractical.com/wiki/ManualScrips cheers david - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017 - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
[rt-users] "On Reply" set ticket status to "resolved"
Hello list, I would like to set a tickets status to "resolved" on reply. The wiki mentions a "On Reply" action that I cannot find in my rt instance. https://rt-wiki.bestpractical.com/wiki/ManualScrips cheers david - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
[rt-users] bounce messages
Hello list, I took over maintenance of a RT 4.4.0 installation and we are having issues with a plugin (https://github.com/MarkHofstetter/RT-Extension-BounceEmail) that is supposed to bounce messages. Issues: 1) the bounced email has the mail address of the RT installation as sender instead of the ticket requestor. 2) it works with plain text mails but not with text/html mails. any help is appreciated regards david - RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
Re: [rt-users] Re-Display Ticket with added warning if owner changed during responding
On 27.06.2016 21:31, Jim Brandt wrote: On 6/27/16 1:38 PM, Jim Brandt wrote: Hey and thank you for your answer, I am using RT 4.4 <%init> warn 'set checks_failure => 1'; $checks_failure = 1; <%args> $checks_failure => undef I expected every update to fail, but when I add a reply the ticket is updated with "correspondence added". I noticed that outside of the Callback component $checks_failure value is 0. And that seems to be the cause while changing checks_failure inside of the callback doesnt have an effect. Is there a reason why $checks_failure isnt passed by reference? I dont want to add code to Ticket/Update.html because I want to make a maintainable extension that isnt lost in case of an RT upgrade. Hmm, yeah, that's strange. Everything else is passed by reference, we may need to look into changing that. In the meantime, you could update just that line to pass $checks_failure by reference to limit your changes to Update.html. Alternatively, you could add another line that duplicates the existing callback but passes checks_failure by reference. Then give it your own name for CallbackName. That might make it easier to pull forward when upgrading. Looking closer, I believe $skip_update was added just for this purpose since it also can stop the update and is passed by reference. I think setting $skip_update to 1 when you want to trigger the message should do the trick. - RT 4.4 and RTIR Training Sessions https://bestpractical.com/training * Los Angeles - September, 2016 thank you very much. its working now. https://github.com/davewood/RT-Extension-WarnTicketTaken - RT 4.4 and RTIR Training Sessions https://bestpractical.com/training * Los Angeles - September, 2016
Re: [rt-users] Re-Display Ticket with added warning if owner changed during responding
On 24.06.2016 14:19, Jim Brandt wrote: On 6/23/16 8:19 AM, David Schmidt wrote: Hello In case someone takes the ticket ownership wile I am composing a response I would like to redisplay the ticket (the submitted response shouldnt be deleted) and add a warning informing the user about the change in ownership. I guess this is the correct callback html/Callbacks/RT-Extension-WarnTicketTaken/Ticket/Update.html/BeforeSubmit but /Ticket/Update.html is quite the monster for an unexperienced RT dev. :) Where can I get the response text from so it doesnt get lost and how do I add a warning? I might try the BeforeUpdate callback. You should be able to use the validation code to add your new check. You can make the page redisplay by setting $checks_failure to 1 and you can display a message by adding it to @results. BeforeUpdate gives you both of those. You can see an example above after the call to ValidateCustomFields. unless ( $status ) { push @results, @msg; $checks_failure = 1; } You shouldn't need to worry about re-adding input values yourself, it should happen automatically. You didn't mention your RT version, but this should be similar across most current versions. - RT 4.4 and RTIR Training Sessions https://bestpractical.com/training * Los Angeles - September, 2016 Hey and thank you for your answer, I am using RT 4.4 <%init> warn 'set checks_failure => 1'; $checks_failure = 1; <%args> $checks_failure => undef I expected every update to fail, but when I add a reply the ticket is updated with "correspondence added". I noticed that outside of the Callback component $checks_failure value is 0. And that seems to be the cause while changing checks_failure inside of the callback doesnt have an effect. Is there a reason why $checks_failure isnt passed by reference? I dont want to add code to Ticket/Update.html because I want to make a maintainable extension that isnt lost in case of an RT upgrade. cheers david - RT 4.4 and RTIR Training Sessions https://bestpractical.com/training * Los Angeles - September, 2016
[rt-users] Re-Display Ticket with added warning if owner changed during responding
Hello In case someone takes the ticket ownership wile I am composing a response I would like to redisplay the ticket (the submitted response shouldnt be deleted) and add a warning informing the user about the change in ownership. I guess this is the correct callback html/Callbacks/RT-Extension-WarnTicketTaken/Ticket/Update.html/BeforeSubmit but /Ticket/Update.html is quite the monster for an unexperienced RT dev. :) Where can I get the response text from so it doesnt get lost and how do I add a warning? regards david - RT 4.4 and RTIR Training Sessions https://bestpractical.com/training * Los Angeles - September, 2016
Re: [rt-users] Show Ticket Message in Search/Results.html
On 25.04.2016 09:58, David Schmidt wrote: On 25.04.2016 08:49, Christian Loos wrote: Am 25.04.2016 um 08:46 schrieb David Schmidt: Another path that looks weird to me is: "local/Callbacks/YourOrg/Elements/RT__Ticket/ColumnMap/Once" shouldnt that be "local/Callbacks/YourOrg/Elements/RT/Ticket/ColumnMap/Once" Arg ... I missed this, this must be "local/html/Callbacks/YourOrg/Elements/RT__Ticket/ColumnMap/Once" Chris Hey Chris, thanks for your help. After a bit of debugging these appear to be the correct locations: "local/html/Callbacks/Univie/Search/Elements/BuildFormatString/Default" "local/html/Callbacks/Univie/Elements/RT__Ticket/ColumnMap/Once" "local/lib/RT/Ticket_Local.pm" I'll wrap everything up in an extension and put it on github. cheers david - RT 4.4 and RTIR Training Sessions https://bestpractical.com/training * Washington DC - May 23 & 24, 2016 https://github.com/davewood/RT-Extension-TicketPreview - RT 4.4 and RTIR Training Sessions https://bestpractical.com/training * Washington DC - May 23 & 24, 2016
Re: [rt-users] Show Ticket Message in Search/Results.html
On 25.04.2016 08:49, Christian Loos wrote: Am 25.04.2016 um 08:46 schrieb David Schmidt: Another path that looks weird to me is: "local/Callbacks/YourOrg/Elements/RT__Ticket/ColumnMap/Once" shouldnt that be "local/Callbacks/YourOrg/Elements/RT/Ticket/ColumnMap/Once" Arg ... I missed this, this must be "local/html/Callbacks/YourOrg/Elements/RT__Ticket/ColumnMap/Once" Chris Hey Chris, thanks for your help. After a bit of debugging these appear to be the correct locations: "local/html/Callbacks/Univie/Search/Elements/BuildFormatString/Default" "local/html/Callbacks/Univie/Elements/RT__Ticket/ColumnMap/Once" "local/lib/RT/Ticket_Local.pm" I'll wrap everything up in an extension and put it on github. cheers david - RT 4.4 and RTIR Training Sessions https://bestpractical.com/training * Washington DC - May 23 & 24, 2016
Re: [rt-users] Show Ticket Message in Search/Results.html
I tried that already and it didnt change a thing. I run the dev server directly form the command line (./sbin/rt-server --port 3000) and dont get an error msg. Another path that looks weird to me is: "local/Callbacks/YourOrg/Elements/RT__Ticket/ColumnMap/Once" shouldnt that be "local/Callbacks/YourOrg/Elements/RT/Ticket/ColumnMap/Once" ? On 25.04.2016 07:59, Christian Loos wrote: Am 23.04.2016 um 10:25 schrieb David Schmidt: On a sidenote (and without intention to blame you for anything) RT development is horrible to debug. :) You should see in your logs a message like 'function TicketPreview not defined' ... $ cat local/lib/rt/Ticket_Local.pm because the correct path is local/lib/RT/Ticket_Local.pm Chris - RT 4.4 and RTIR Training Sessions https://bestpractical.com/training * Washington DC - May 23 & 24, 2016
Re: [rt-users] Show Ticket Message in Search/Results.html
On 21.04.2016 15:56, Emmanuel Lacour wrote: Le 21/04/2016 15:12, David Schmidt a écrit : When I list tickets I want to show the first 3 lines of the ticket message for each ticket. I am using the following patch to achieve this, but it is quite a hack. Can someone recommend a cleaner solution. you don't have to patch, you can use the callback "Once" in Elements/RT__Ticket/ColumnMap so just create a file local/Callbacks/YourOrg/Elements/RT__Ticket/ColumnMap/Once with a content that will ad such column. Something like: <%init> $COLUMN_MAP->{First3Lines} = { title => 'First3Lines', value => sub { return loc($_[0]->First3Lines) } }; <%args> $COLUMN_MAP => undef $GenericMap => undef And in a local/lib/rt/Ticket_Local.pm: package RT::Ticket; use strict; no warnings qw(redefine); use utf8; sub First3Lines { my $self = shift; [your code here] return $content; } 1; Then another callback to make this new "First3Lines" available as a columns in the search builder: local/Callbacks/YourOrg/Search/Elements/BuildFormatString/Default <%init> push @$Fields, 'First3Lines'; <%args> $Fields => undef this way, you don't have to patch and your changes should stay as is from rt versions to rt versions. Hello Emmanuel, this sounds like solid advice, thank you very much. I wrote the following code following your example but it seems there is an error somewhere. "TicketPreview" shows up in the Search/Results.html table but the cell is empty for each row. On a sidenote (and without intention to blame you for anything) RT development is horrible to debug. :) I attached 2 screenshots. $ cat local/Callbacks/Univie/Elements/RT__Ticket/ColumnMap/Once <%init> $COLUMN_MAP->{TicketPreview} = { title => 'TicketPreview', value => sub { return loc($_[0]->TicketPreview) } }; <%args> $COLUMN_MAP => undef $GenericMap => undef $ cat local/lib/rt/Ticket_Local.pm package RT::Ticket; use strict; use warnings; sub TicketPreview { my $self = shift; my $content = 'foobar'; return $content; } 1; $ cat local/Callbacks/Univie/Search/Elements/BuildFormatString/Default <%init> push @$Fields, 'TicketPreview'; <%args> $Fields => undef - RT 4.4 and RTIR Training Sessions https://bestpractical.com/training * Washington DC - May 23 & 24, 2016
[rt-users] Show Ticket Message in Search/Results.html
When I list tickets I want to show the first 3 lines of the ticket message for each ticket. I am using the following patch to achieve this, but it is quite a hack. Can someone recommend a cleaner solution. local/html/Elements/CollectionList# BEGIN TicketPreview in Search/Results.html # # Installation: cp share/html/Elements/CollectionList local/html/Elements/ # then open the copy and insert this code between the lines # "$m->callback( CallbackName => 'EachRow', ... );" # and # "$m->comp('/Elements/CollectionAsTable/Row', ... );" # Important!!! you need to configure the DefaultSearchResultFormat # otherwise ht preview won't be displayed # Example: etc/RT_SiteConfig.pm # Set ($DefaultSearchResultFormat, qq{ # ... # '__Preview__', # ... # }); $column_map->{Preview} = { 'align' => undef, 'value' => sub { my $res = $record->Attachments(); my $attachment = $res->First; return '' unless $attachment; my $content = $attachment->Content; return '' unless $content; open(my $fh, '<', \$content) or die $!; my @preview = (); while(my $line = <$fh>) { # rm html tags $line =~ s/\<.*?\>//xmsg; # ignore empty lines push(@preview, $line) if ($line !~ m/^\s*$/xms); last if scalar @preview >= 3; } return @preview; }, 'style' => undef }; # END TicketPreview in Search/Results.html # - RT 4.4 and RTIR Training Sessions https://bestpractical.com/training * Washington DC - May 23 & 24, 2016