[rt-devel] Customizing Business::Hours

Ruslan Zakirov ruz at bestpractical.com
Tue Jul 3 18:33:32 EDT 2012


Hi,

A few comments:

1) there should be empty line between POD and code

2) The following can be written in one line "my $t = shift || time;":

 ⋅⋅⋅⋅⋅⋅⋅my $t = shift;
 ⋅⋅⋅⋅⋅⋅⋅
 ⋅⋅⋅⋅⋅⋅⋅unless ( $t ) {
 ⋅⋅⋅⋅⋅⋅⋅ ⋅⋅⋅⋅⋅⋅⋅$t = time;
 ⋅⋅⋅⋅⋅⋅⋅}

3)  I would prefer 4 spaces rather than tabs, but can convert it before
applying

4) all commented code should be deleted before it goes into repository

5) in the following line $end can be "my $end = $start+24*60*60" rather
than function call:

my $end = timelocal_nocheck(59,59,23, at t_array[3..5]);

6) bday_end has problems if business day spans over midnight

7) bday_end needs better name without shortings

8) again is_business_day_after and is_business_day suffer from assumption
that business day can not span over midnight.

As far as I recall in the latest version we support 24/7 setups with Start
=> 06:00, End => 06:00. At least I recall doing something about business
hours spanning over midnight.

To be included it really need tests.

Some comments below.

On Tue, Jul 3, 2012 at 1:21 AM, Alberto Scotto
<scotto.alberto.86 at gmail.com>wrote:

> Hi all,
>
> I'm not sure this is the right place for discussions about perl modules
> not part of RT's codebase, but since Business::Hours is strictly related to
> SLA, and SLA is strictly related to RT.... Here I am.
>

Not a bad place.


> Long story short, I added a few subs to Hours.pm in order to have the
> possibility to set the next business day as the due date. The main sub is
> *end_of_next_business_day*


I think main sub is very specific for your use case. Instead I would prefer
last_after method that is similar to first_after.

One concern I have is about the timezone. Simply I didn't mind about it,
> for, as far as I can see, Business::Hours' author didn't mind as well. Is
> it alright?
>

The module uses localtime so timezone can be controlled from outside by
changing TZ variable and calling POSIX::tzset. There is experimental code
in SLA repository to deal with multiple timezones.


> Please, test it if you like, and give me some feedback.
>
> If interested, I can show you how to integrate my custom Hours.pm with
> RT::Extension::SLA
>
>
> Regards
>
> *Alberto Scotto*
>
> skype:dasgazzo
>
>
> --------
> List info:
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
>
>


-- 
Best regards, Ruslan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-devel/attachments/20120704/b515603b/attachment.html>


More information about the rt-devel mailing list