1 package FS::part_event::Condition::day_of_week;
4 use base qw( FS::part_event::Condition );
5 use FS::Record qw( dbh );
7 tie my %dayofweek, 'Tie::IxHash',
18 "Run only on certain days of the week",
24 label => 'Days to run',
25 type => 'checkbox-multiple',
26 options => [ values %dayofweek ],
27 option_labels => { map { $_ => $_ } values %dayofweek },
32 sub condition { # is this even necessary? condition_sql is exact.
33 my( $self, $object, %opt ) = @_;
35 my $today = $dayofweek{(localtime($opt{'time'}))[6]};
36 if (grep { $_ eq $today } (keys %{$self->option('dayofweek')})) {
43 my( $class, $table, %opt ) = @_;
44 my $today = $dayofweek{(localtime($opt{'time'}))[6]};
45 my $day = $class->condition_sql_option_option('dayofweek');
46 return dbh->quote($today) . " IN $day";