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


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;
}


<%args>
$Actions => []



BeforeMessageBox:
<%init>
my $Ticket = LoadTicket($ARGS{'id'});

<& /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 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;
}


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 => []


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-25 Thread Koopmann, Jan-Peter
On Tuesday, July 25, 2006 5:35 PM Todd Chapman wrote:

> In Display.html add  "Actions => [EMAIL PROTECTED]" to the callback arguments.
> In the callback itself add line "push @{$ARGS{Actions}},
> @cf_results;".  

This causes a loop here. At the bottom of Display.html 

if (@Actions) 

is true even though @Actions is empty. 

if (scalar(@Actions) == 0) {


on the other hand works as expected. Strange. Moreover the actions are not 
displayed at the top of the Display.html result anymore even though the changes 
are submitted. We will debug this further tomorrow but maybe you have an idea?


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-25 Thread Koopmann, Jan-Peter
On Tuesday, July 25, 2006 5:05 PM Todd Chapman wrote: 

> > I found the problem. At the bottom of Display.html a redirect was
> added before the callback that EditCustomFieldsOnUpdate is trying to
> use to update the CFs. If the callback was moved above the preceeding
> if statement things should start working.   

You are my hero of the day. Thanks!

> The callback also needs @Actions passed to it so that the CF updates
> can be recorded. 

That part I honestly do not fully understand. Would you happen to have a
patch?

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


[rt-users] EditCustomFieldsOnUpdate does not work anymore

2006-07-25 Thread Koopmann, Jan-Peter
Hi,

looks like the callback based solution described here

http://wiki.bestpractical.com/index.cgi?EditCustomFieldsOnUpdate

does not work anymore. The custom fields are displayed correctly on 
Update.html. If I change values and do not put anything in the 
correspondence/comments field, press save changes, all custom field changes are 
processed without problems. If I however enter text in the correspondence field 
and then save changes all that happens is "message recorded" and the custom 
field values stay untouched.

Any ideas?


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] Predefined search My Requests not found

2006-07-20 Thread Koopmann, Jan-Peter
On Thursday, July 20, 2006 4:15 PM Koopmann, Jan-Peter wrote:

> We just upgraded from 3.4.4 to 3.6.0 and the start screen now shows


Forget it. There was a changed "index.html" in local. Silly me.


smime.p7s
Description: S/MIME cryptographic signature
___
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

[rt-users] Predefined search My Requests not found

2006-07-20 Thread Koopmann, Jan-Peter
Hi,

We just upgraded from 3.4.4 to 3.6.0 and the start screen now shows

"Predefined search My Requests not found"


Any ideas?


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] RT::Attribute::Name Unimplemented

2006-07-10 Thread Koopmann, Jan-Peter
On Thursday, July 06, 2006 5:33 PM Jesse Vincent wrote:

> Nobody's been able to reliably reproduce it and it's not something
> we're seeing here. 

It happens at one of our sites quite regularly (few times a day) but I have not 
yet found a way of clearly reproducing it.

> I do know that with current SearchBuilder and RT,
> folks who were complaining about it were complaining a lot less.  

RT 3.4.4 and SearchBuilder 1.43 and this causes problems... Do you think 3.4.5 
would be wise?


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


[rt-users] TransactionBatch

2006-06-22 Thread Koopmann, Jan-Peter
Hi,

I have a small scrip that changes a custom field to "IT" in case a 
correspondence is added to a ticket by a user who is not member of the IT group:

Condition: On Correspond
Action: User Definded
Template: Blank
Stage: TransactionCreate

Preparation: return 1;
Cleanup code:

my $group = 'IT';

my $PrincipalObj = RT::Principal->new( $self->TransactionObj->CreatorObj );
$PrincipalObj->Load( $self->TransactionObj->CreatorObj->Id );

my $groupobj = RT::Group->new($self->TransactionObj->CreatorObj );
$groupobj->LoadUserDefinedGroup($group);
my $HasMember = $groupobj->HasMemberRecursively( $PrincipalObj );

if (! $HasMember) {
$RT::Logger->info("Ticket changed by admin");

my $CFName = 'Wartet auf';
my $DefaultValue = 'IT';
my $RecTransaction = 1;

my $QueueObj = $self->TicketObj->QueueObj;
my $CFObj = RT::CustomField->new( $QueueObj->CurrentUser );
$CFObj->LoadByNameAndQueue( Name => $CFName, Queue => 0 );
unless( $CFObj->id ) {
  $RT::Logger->warning( "$CFName doesn't exist, Queue -". 
$QueueObj->Name ."-" );
  return undef; 
}

if ( $self->TicketObj->FirstCustomFieldValue( $CFObj->id ) eq "User" ) {
   my( $st, $msg ) = $self->TicketObj->AddCustomFieldValue(
  Field => $CFObj->id,
  Value => $DefaultValue,
  RecordTransaction => 
$RecTransaction );
   unless( $st ) {
  $RT::Logger->warning( "Couldn't set $DefaultValue as value for CF 
$CFName:". $msg );
  return undef;
}
}
}


My problem: If the custom field "Wartet auf" is shown in the Update page it 
sometimes happens that the scrip changes the field to "IT" and a later 
transaction changes it back to the former value (the one shown in the update 
field):

#   Do. 22. Jun. 2006, 08:45:00 t.user - Wartet auf IT changed 
to User   
#   Do. 22. Jun. 2006, 08:45:00 RT_System - Wartet auf User 
changed to IT
#   Do. 22. Jun. 2006, 08:44:59 RT_System - Ausgehende Mail 
gespeichert  [Zeige] 
#   Do. 22. Jun. 2006, 08:44:59 RT_System - Ausgehende Mail 
gespeichert  [Zeige] 
#   Do. 22. Jun. 2006, 08:44:58 t.user - Correspondence added   
 [Antworten] [Kommentar]

I suspect the update page created several transactions, one for the 
Correspondence and maybe one for custom field? If so, I thought that 
TransactionBatch would be the solution. So I changed the scrip to 
TransactionBatch stage and nothing happens, it simply does not fire (yes 
UseTransactionBatch in RT_SiteConfig is set and apache restarted). Why? 

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] Due Date not set automatically

2006-06-21 Thread Koopmann, Jan-Peter
On Wednesday, June 21, 2006 4:13 PM Niels Huylebroeck wrote:

> Setting a default due date depends on the Queue settings, be sure to
> set your "Requests should be due in:" field in the Queue
> configuration.  

That is the setting I was referring to. This is set on both installations.
On 3.4.4 it works on 3.4.5 it does not (at least not here).

> anymore either... I recently updated to 3.6.0. and was testing just
> now but there is no DueDate being set.  

Could this be a general bug then?

Kind regards,
  JP


smime.p7s
Description: S/MIME cryptographic signature
___
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

[rt-users] Due Date not set automatically

2006-06-21 Thread Koopmann, Jan-Peter
Hi,

on my first rt installation I only set the default due date in a queue and new 
tickets automatically are assigned a default due date. But on a second box 
(3.4.5) this does not happen. At least not immediately. Is there something I 
missed?

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


[rt-users] Change duedate/priorities from Reply screen

2006-06-12 Thread Koopmann, Jan-Peter
Hi,

I would love to be able to change the current priority and duedate from
the reply, comment etc. screens. I am sure this can be done with
Overlays/Callbacks but I am not sure how and what to call. Surely
someone already has done this one way or the other.

Any help is greatly appreciated!

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