[rt-users] Date format to set Due Date with scrip?
Loos, Christian
CLoos at netcologne.de
Thu May 20 11:28:10 EDT 2010
Just checked my code in our development system and changed it.
Try this:
my $Due = new RT::Date( $self->CurrentUser );
$Due->SetToNow();
$Due->AddDays( 7 );
$self->TicketObj->SetDue( $Due->ISO );
return 1;
This is working on 3.8.6 and should work on 3.6.2 also.
> -----Ursprüngliche Nachricht-----
> Von: Steven Platt [mailto:Steven.Platt at hpa.org.uk]
> Gesendet: Donnerstag, 20. Mai 2010 17:10
> An: Loos, Christian
> Betreff: RE: Date format to set Due Date with scrip?
>
> APACHE error_log
>
> [Thu May 20 14:56:11 2010] [crit]: RT::Ticket=HASH(0xb9da940)
> tried to load a bogus ticket: 998
> (/opt/rt3/lib/RT/Ticket_Overlay.pm:258)
> [Thu May 20 14:56:11 2010] [crit]: RT::Ticket=HASH(0xb9db108)
> tried to load a bogus ticket: 998
> (/opt/rt3/lib/RT/Ticket_Overlay.pm:258)
> [Thu May 20 14:56:11 2010] [crit]: HasRight called with no
> valid object (/opt/rt3/lib/RT/Principal_Overlay.pm:321)
> [Thu May 20 14:56:11 2010] [crit]: RT::Ticket=HASH(0xbdc6294)
> tried to load a bogus ticket: 998
> (/opt/rt3/lib/RT/Ticket_Overlay.pm:258)
> [Thu May 20 14:56:11 2010] [error]: Ticket couldn't be
> created: (/opt/rt3/lib/RT/Ticket_Overlay.pm:762)
> [Thu May 20 14:56:11 2010] [error]: WebRT: Ticket could not
> be created due to an internal error ()
> (/opt/rt3/local/html/Elements/Error:76)
>
> It's the same list of errors for all four attempts to create
> tickets using this scrip code (ticket numbers change though)
>
> There are no files in /opt/rt3/var/log
>
> -----Original Message-----
> From: Loos, Christian [mailto:CLoos at netcologne.de]
> Sent: 20 May 2010 16:01
> To: Steven Platt
> Cc: rt-users at lists.bestpractical.com
> Subject: AW: Date format to set Due Date with scrip?
>
> What is in the log files?
>
> > -----Ursprüngliche Nachricht-----
> > Von: Steven Platt [mailto:Steven.Platt at hpa.org.uk]
> > Gesendet: Donnerstag, 20. Mai 2010 16:58
> > An: Loos, Christian
> > Cc: rt-users at lists.bestpractical.com
> > Betreff: RE: Date format to set Due Date with scrip?
> >
> > I added these but got the same result.
> >
> > -----Original Message-----
> > From: Loos, Christian [mailto:CLoos at netcologne.de]
> > Sent: 20 May 2010 15:41
> > To: Steven Platt
> > Cc: rt-users at lists.bestpractical.com
> > Subject: AW: Date format to set Due Date with scrip?
> >
> > You need in Custom action prep code:
> > return 1;
> > and at the end of my example also a:
> > return 1;
> >
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Steven Platt [mailto:Steven.Platt at hpa.org.uk]
> > > Gesendet: Donnerstag, 20. Mai 2010 15:44
> > > An: Loos, Christian
> > > Cc: rt-users at lists.bestpractical.com
> > > Betreff: RE: Date format to set Due Date with scrip?
> > >
> > > Thanks Chris,
> > >
> > > Unfortunately this gives me a 'ticket could not be
> created due to an
> > > internal error' message. Tried it both as a regular and as a
> > > privileged
> > > user.
> > >
> > > The notification emails are generated but a search for the
> > > ticket number
> > > gives 'Could not load ticket NUMBER'. The ticket number is also
> > > incremented.
> > >
> > >
> > > teve
> > >
> > >
> > > -----Original Message-----
> > > From: Christian Loos [mailto:cloos at netcologne.de]
> > > Sent: 20 May 2010 14:24
> > > To: Steven Platt
> > > Cc: rt-users at lists.bestpractical.com
> > > Subject: Re: Date format to set Due Date with scrip?
> > >
> > > I think better would be this way:
> > >
> > > my $Due = new RT::Date( $self->CurrentUser );
> > > $Due->SetToNow;
> > > $Due->AddDays( 7 );
> > > $self->TicketObj->SetDue( Format =>, 'ISO', Value => $Due->ISO );
> > >
> > >
> > > --
> > > Chris
> > >
> > > Am 20.05.2010 14:28, schrieb Steven Platt:
> > > > Hi,
> > > >
> > > > The config setting 'Requests should be due in:' is not
> > > working, so I'm
> > > > trying to write a scrip to set the DueDate on ticket
> > > creation. I'm on
> > > RT
> > > > v3.6.2 and don't want to upgrade just for this issue.
> > > >
> > > > Following advice on the wiki I've got the following
> > > >
> > > > Condition: On Create
> > > >
> > > > Action: user defined
> > > >
> > > > Template: Global template: blank
> > > >
> > > > Custom action prep code: 1;
> > > >
> > > > Custom action cleanup code:
> > > >
> > > > use Date::Calc qw(:all);
> > > >
> > > > ($year,$month,$day) = Today([$gmt]);
> > > >
> > > > ($year2,$month2,$day2) = Add_Delta_Days($year,$month,$day,"7");
> > > >
> > > > $string = Date_to_Text($year2,$month2,$day2);
> > > >
> > > > $lower = ISO_LC($string);
> > > >
> > > > $self->TicketObj->SetDue($lower);
> > > >
> > > > Due Date is not set though L
> > > >
> > > > Running this on command line, $lower prints a date
> > formatted as 'thu
> > > > 27-may-2010'
> > > >
> > > > I can hack around with the date format if someone can tell
> > > me what it
> > > > should be so that RT will accept it into the database
> (postgres).
> > > >
> > > > Thanks
> > > >
> > > > Steve
> > > >
> > > > Dr Steven Platt
> > > >
> > > > Bioinformatician
> > > >
> > > > Health Protection Agency
> > > >
> > > > Centre for Infections
> > > >
> > > > London
> > > >
> > > > ___www.hpa.org.uk/bioinformatics_
> > > <http://www.hpa.org.uk/bioinformatics>
> > > >
> > > >
> > > --------------------------------------------------------------
> > > ----------
> > > >
> > > > *
> > > >
> > > **************************************************************
> > > **********
> > > **
> > > > The information contained in the EMail and any attachments is
> > > > confidential and intended solely and for the attention and
> > > use of the
> > > > named addressee(s). It may not be disclosed to any other person
> > > without
> > > > the express authority of the HPA, or the intended
> > > recipient, or both.
> > > If
> > > > you are not the intended recipient, you must not disclose, copy,
> > > > distribute or retain this message or any part of it.
> This footnote
> > > also
> > > > confirms that this EMail has been swept for computer
> viruses, but
> > > please
> > > > re-sweep any attachments before opening or saving.
> > > HTTP://www.HPA.org.uk
> > > >
> > > **************************************************************
> > > **********
> > > ** *
> > > >
> > > >
> > > >
> > > >
> > > > Discover RT's hidden secrets with RT Essentials from
> > O'Reilly Media.
> > > > Buy a copy at http://rtbook.bestpractical.com
> > >
> > > -----------------------------------------
> > > **************************************************************
> > > ************
> > > The information contained in the EMail and any attachments is
> > > confidential and intended solely and for the attention and use of
> > > the named addressee(s). It may not be disclosed to any
> other person
> > > without the express authority of the HPA, or the intended
> > > recipient, or both. If you are not the intended
> recipient, you must
> > > not disclose, copy, distribute or retain this message or any part
> > > of it. This footnote also confirms that this EMail has been swept
> > > for computer viruses, but please re-sweep any attachments before
> > > opening or saving. HTTP://www.HPA.org.uk
> > > **************************************************************
> > > ************
> > >
> > -----------------------------------------
> > **************************************************************
> > ************
> > The information contained in the EMail and any attachments is
> > confidential and intended solely and for the attention and use of
> > the named addressee(s). It may not be disclosed to any other person
> > without the express authority of the HPA, or the intended
> > recipient, or both. If you are not the intended recipient, you must
> > not disclose, copy, distribute or retain this message or any part
> > of it. This footnote also confirms that this EMail has been swept
> > for computer viruses, but please re-sweep any attachments before
> > opening or saving. HTTP://www.HPA.org.uk
> > **************************************************************
> > ************
> >
> -----------------------------------------
> **************************************************************
> ************
> The information contained in the EMail and any attachments is
> confidential and intended solely and for the attention and use of
> the named addressee(s). It may not be disclosed to any other person
> without the express authority of the HPA, or the intended
> recipient, or both. If you are not the intended recipient, you must
> not disclose, copy, distribute or retain this message or any part
> of it. This footnote also confirms that this EMail has been swept
> for computer viruses, but please re-sweep any attachments before
> opening or saving. HTTP://www.HPA.org.uk
> **************************************************************
> ************
>
More information about the rt-users
mailing list