[rt-users] Business::Hours anyone?

Gene LeDuc gleduc at mail.sdsu.edu
Wed Apr 25 17:45:55 EDT 2007


DING DING DING DING DING DING DING DING DING DING DING DING - We have a winner!

Thanks for taking a look at the code, your change did the trick!

Gene

At 02:12 PM 4/25/2007, Robert Long wrote:
>Try it like this:
>
>$hours->business_hours(
>      0 => { Name => 'Sunday', Start => undef, End => undef },
>       1 => { Name => 'Monday', Start => '08:00', End => '16:30' },
>       2 => { Name => 'Tuesday', Start => '08:00', End => '16:30' },
>       3 => { Name => 'Wednesday', Start => '08:00', End => '16:30' },
>       4 => { Name => 'Thursday', Start => '15:00', End => '23:30' },
>       5 => { Name => 'Friday', Start => '15:00', End => '23:30' },
>       6 => { Name => 'Saturday', Start => undef, End => undef }
>  );
>
>( notice the missing "{" and "}" )
>
>.r'
>
>
>Gene LeDuc wrote:
> > Hi Robert,
> >
> > When a ticket is created I want to include a statement in the e-mail
> > to the requestor that the ticket should be closed in 5 business days,
> > and if they haven't heard back from us by then to call us.  I'm using
> > Business::Hours to compute "then" and have basically copied the
> > example from the wiki.  The problem I'm having is that the
> > "add_seconds" method is returning -1, which the docs seem to say means
> > that the result is more than 30 days in the future.
> >
> > Here's my code:
> >
> >   my $days = 5;
> >   my $seconds = $days * 8.5 * 60 * 60;
> >   $RT::Logger->debug("$MyName: days: $days, seconds: $seconds");
> >   my $hours = Business::Hours->new();
> >   $hours->business_hours(
> >     { 0 => { Name => 'Sunday', Start => undef, End => undef },
> >       1 => { Name => 'Monday', Start => '08:00', End => '16:30' },
> >       2 => { Name => 'Tuesday', Start => '08:00', End => '16:30' },
> >       3 => { Name => 'Wednesday', Start => '08:00', End => '16:30' },
> >       4 => { Name => 'Thursday', Start => '15:00', End => '23:30' },
> >       5 => { Name => 'Friday', Start => '15:00', End => '23:30' },
> >       6 => { Name => 'Saturday', Start => undef, End => undef }
> >     } );
> >   my $curtime = time;
> >   my $duetime = $hours->add_seconds ($curtime, $seconds);
> >   $RT::Logger->debug("$MyName: curtime: $curtime, duetime: $duetime");
> >
> > And here's what I'm seeing in my logs:
> >
> >   [Wed Apr 25 20:05:00 2007] [debug]: Scrip DNS:35:Commit (New
> > Ticket): days: 5, seconds: 153000 ((eval 362):30)
> >   [Wed Apr 25 20:05:00 2007] [debug]: Scrip DNS:35:Commit (New
> > Ticket): curtime: 1177531500, duetime: -1 ((eval 362):43)
> >
> > I expect the $duetime result to be ($curtime + 5 business days), or
> > exactly 1 real week from $curtime.  Any thoughts on where I should
> > start looking?
> >
> > Thanks,
> > Gene
> >
> > At 10:39 AM 4/25/2007, Robert Long wrote:
> >> Gene LeDuc wrote:
> >> > Hi All,
> >> >
> >> > If anyone has used the Business::Hours module successfully, I have
> >> > what should be a pretty simple question.
> >> >
> >> > Thanks,
> >> > Gene
> >> >
> >> >
> >> >
> >> Yeah, I use the Business:Hours in a medium complex setting, what is your
> >> question (I'd rather keep it on the list so if anyone else has the
> >> same/similar question it'll get answered here)
> >>
> >> .r'
> >
> >


-- 
Gene LeDuc, GSEC
Security Analyst
San Diego State University 




More information about the rt-users mailing list