RE: [rt-users] EditCustomFieldsOnUpdate does not work anymore

2006-07-26 Thread Koopmann, Jan-Peter
On Tuesday, July 25, 2006 9:12 PM Todd Chapman wrote:

 I updated the
 rt/local/html/Callbacks/CustomFields/Ticket/Display.html/BeforeDisplay
 on the wiki.  

I am not sure this will work. ProcessObjectCustomFieldUpdates seems to return 
an array with an empty element even if it did not change anything. The 
following if therefore always redirects to Display.html causing a loop. This is 
very reproducable here with Perl 5.8.7 on FreeBSD. What did help was this:

%init
my $ARGSRef = $ARGS{'ARGSRef'};
if ($$ARGSRef{'id'} ne 'new'){
my $Ticket = LoadTicket($$ARGSRef{'id'});
my @cf_results = ProcessObjectCustomFieldUpdates(ARGSRef = $ARGSRef);
delete $cf_results[0] if ((scalar(@cf_results) == 1)  ($cf_results[0] 
eq ''));
push @{$ARGS{Actions}}, @cf_results;
}
/%init

With this change everything works like a charm here (of course after putting 
the Callback in front of the if in Display.html which should be noted in the 
wiki as well btw. What is

%args
$Actions = []
/%args

doing exactly? Things work without it as well. Moreover: Will someone 
talk/write to Jesse about the change in Display.html? This should be patched 
into rt.

Kind regards,
  JP
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


We're hiring! Come hack Perl for Best Practical: 
http://bestpractical.com/about/jobs.html


RE: [rt-users] EditCustomFieldsOnUpdate does not work anymore

2006-07-26 Thread Koopmann, Jan-Peter
On Wednesday, July 26, 2006 1:02 PM Jason A. Diegmueller wrote:

 Perhaps this is an unintended side effect (or perhaps it's by
 design), but the only problem I've found with this approach is that
 Custom Field changes don't get mentioned at the top.  I get Message
 recorded or Status changed to xxx, but I don't see the CF changes
 even though they are made.

That is strange. With 3.6.0 and after these changes this works for us for the 
first time. All changes on the update page seem to be recorded at the top of 
the resulting Display.html and all changes show in the following section. Let's 
compare one more time. My setup currently:

BeforeDisplay:
%init
my $ARGSRef = $ARGS{'ARGSRef'};
if ($$ARGSRef{'id'} ne 'new'){
my $Ticket = LoadTicket($$ARGSRef{'id'});
my @cf_results = ProcessObjectCustomFieldUpdates(ARGSRef = $ARGSRef);
my @dresults = ProcessTicketDates( TicketObj = $Ticket, ARGSRef = 
$ARGSRef);

delete $cf_results[0] if ((scalar(@cf_results) == 1)  ($cf_results[0] 
eq ''));
push @{$ARGS{Actions}}, @cf_results, @dresults;
}
/%init

%args
$Actions = []
/%args


BeforeMessageBox:
%init
my $Ticket = LoadTicket($ARGS{'id'});
/%init
 /Ticket/Elements/EditCustomFields, TicketObj = $Ticket 
 /Ticket/Elements/EditDueDate, TicketObj = $ Ticket 
 /Ticket/Elements/EditPriority, TicketObj = $ Ticket 


Bottom of Display.html (the part that Jesse should change):

# This code does automatic redirection if any updates happen.
# It doesn't work for the client.


$m-comp('/Elements/Callback', _CallbackName = 'BeforeDisplay',
 TicketObj = \$TicketObj, Tickets = \$Tickets, ARGSRef = \%ARGS, 
Actions = [EMAIL PROTECTED] );

if (@Actions) {
# We've done something, so we need to clear the decks to avoid
# resubmission on refresh.
# But we need to store Actions somewhere too, so we don't lose them.
$session{Actions} = [EMAIL PROTECTED];
$m-redirect($RT::WebURL.Ticket/Display.html?id=.$TicketObj-id);
} else {
@Actions = @{$session{Actions} || [] };
delete $session{Actions};
}

Please note that in addition to CustomFields we also let the user change 
priority and due dates on the update page. Works like a charm.

Jason, can you confirm that you are running a similar setup with 3.6.x?



Kind regards,
  JP
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


We're hiring! Come hack Perl for Best Practical: 
http://bestpractical.com/about/jobs.html


RE: [rt-users] EditCustomFieldsOnUpdate does not work anymore

2006-07-26 Thread Jason A. Diegmueller

JP, Todd, rt-users--

If modified exactly as listed below, this works completely along with 
proper notifications from RT.


I dropped the @Actions piece in the Callback (and perhaps over-improvised 
by also removing it from Display.html) based on the comment that you made 
(JP) that it was unnecessary.  Re-adding it and doing it exactly as you 
below works fine on my RT3.6.HEAD+Display.html-modification setup.


Sorry for the confusion, I over-improvised.

-jd

On Wed, 26 Jul 2006, Koopmann, Jan-Peter wrote:


On Wednesday, July 26, 2006 1:02 PM Jason A. Diegmueller wrote:


Perhaps this is an unintended side effect (or perhaps it's by
design), but the only problem I've found with this approach is that
Custom Field changes don't get mentioned at the top.  I get Message
recorded or Status changed to xxx, but I don't see the CF changes
even though they are made.


That is strange. With 3.6.0 and after these changes this works for us for the 
first time. All changes on the update page seem to be recorded at the top of 
the resulting Display.html and all changes show in the following section. Let's 
compare one more time. My setup currently:

BeforeDisplay:
%init
my $ARGSRef = $ARGS{'ARGSRef'};
if ($$ARGSRef{'id'} ne 'new'){
   my $Ticket = LoadTicket($$ARGSRef{'id'});
   my @cf_results = ProcessObjectCustomFieldUpdates(ARGSRef = $ARGSRef);
   my @dresults = ProcessTicketDates( TicketObj = $Ticket, ARGSRef = 
$ARGSRef);

   delete $cf_results[0] if ((scalar(@cf_results) == 1)  ($cf_results[0] 
eq ''));
   push @{$ARGS{Actions}}, @cf_results, @dresults;
}
/%init

%args
$Actions = []
/%args


BeforeMessageBox:
%init
my $Ticket = LoadTicket($ARGS{'id'});
/%init
 /Ticket/Elements/EditCustomFields, TicketObj = $Ticket 
 /Ticket/Elements/EditDueDate, TicketObj = $ Ticket 
 /Ticket/Elements/EditPriority, TicketObj = $ Ticket 


Bottom of Display.html (the part that Jesse should change):

# This code does automatic redirection if any updates happen.
# It doesn't work for the client.


$m-comp('/Elements/Callback', _CallbackName = 'BeforeDisplay',
TicketObj = \$TicketObj, Tickets = \$Tickets, ARGSRef = \%ARGS, Actions 
= [EMAIL PROTECTED] );

if (@Actions) {
   # We've done something, so we need to clear the decks to avoid
   # resubmission on refresh.
   # But we need to store Actions somewhere too, so we don't lose them.
   $session{Actions} = [EMAIL PROTECTED];
   $m-redirect($RT::WebURL.Ticket/Display.html?id=.$TicketObj-id);
} else {
   @Actions = @{$session{Actions} || [] };
   delete $session{Actions};
}

Please note that in addition to CustomFields we also let the user change 
priority and due dates on the update page. Works like a charm.

Jason, can you confirm that you are running a similar setup with 3.6.x?



Kind regards,
 JP


___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com



We're hiring! Come hack Perl for Best Practical: 
http://bestpractical.com/about/jobs.html


RE: [rt-users] EditCustomFieldsOnUpdate does not work anymore

2006-07-26 Thread Koopmann, Jan-Peter
On Wednesday, July 26, 2006 2:08 PM Jason A. Diegmueller wrote:

 JP, Todd, rt-users--
 
 If modified exactly as listed below, this works completely along with
 proper notifications from RT. 

Wounderful. I just changed the wiki page to reflect our findings. I will also 
try to reach Jesse in order to patch Display.html permanently. 


Kind regards,
  JP
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


We're hiring! Come hack Perl for Best Practical: 
http://bestpractical.com/about/jobs.html