lib/calcms: remove comments and shorten expressions
This commit is contained in:
@@ -6,6 +6,7 @@ no warnings 'redefine';
|
||||
|
||||
use Data::Dumper;
|
||||
use Date::Calc();
|
||||
|
||||
use time();
|
||||
use db();
|
||||
use log();
|
||||
@@ -16,7 +17,6 @@ use series_schedule();
|
||||
# table: calcms_series_dates
|
||||
# columns: id, studio_id, series_id, start(datetime), end(datetime)
|
||||
# TODO: delete column schedule_id
|
||||
#use base 'Exporter';
|
||||
our @EXPORT_OK = qw(get_columns get insert update delete get_dates get_series);
|
||||
|
||||
sub get_columns ($) {
|
||||
@@ -108,10 +108,9 @@ sub get ($;$) {
|
||||
sub is_event_scheduled($$) {
|
||||
my ($request, $options) = @_;
|
||||
|
||||
return 0 unless defined $options->{project_id};
|
||||
return 0 unless defined $options->{studio_id};
|
||||
return 0 unless defined $options->{series_id};
|
||||
return 0 unless defined $options->{start_at};
|
||||
for ('project_id', 'studio_id', 'series_id', 'start_at') {
|
||||
return 0 unless defined $options->{$_}
|
||||
};
|
||||
|
||||
my $config = $request->{config};
|
||||
my $schedules = series_dates::get(
|
||||
@@ -281,9 +280,9 @@ sub addSeriesScheduleAttributes ($$) {
|
||||
sub update($$) {
|
||||
my ($config, $entry) = @_;
|
||||
|
||||
return undef unless defined $entry->{project_id};
|
||||
return undef unless defined $entry->{studio_id};
|
||||
return undef unless defined $entry->{series_id};
|
||||
for ('project_id', 'studio_id', 'series_id') {
|
||||
return undef unless defined $entry->{$_}
|
||||
};
|
||||
|
||||
my $dbh = db::connect($config);
|
||||
|
||||
@@ -350,7 +349,6 @@ sub update($$) {
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
|
||||
#print STDERR "$i series_dates updates\n";
|
||||
return $j . " dates out of studio times, " . $i;
|
||||
}
|
||||
@@ -457,8 +455,6 @@ sub get_dates($$$$) {
|
||||
my @start_date = ( $start[0], $start[1], $start[2] );
|
||||
my $start_time = sprintf( '%02d:%02d:%02d', $start[3], $start[4], $start[5] );
|
||||
|
||||
#print STDERR "$start_datetime,$end_date,$duration,$frequency\n";
|
||||
|
||||
#return on single date
|
||||
my $date = {};
|
||||
$date->{start} = sprintf( "%04d-%02d-%02d", @start_date ) . ' ' . $start_time;
|
||||
@@ -505,9 +501,9 @@ sub get_dates($$$$) {
|
||||
sub delete ($$) {
|
||||
my ($config, $entry) = @_;
|
||||
|
||||
return unless defined $entry->{project_id};
|
||||
return unless defined $entry->{studio_id};
|
||||
return unless defined $entry->{series_id};
|
||||
for ('project_id', 'studio_id', 'series_id') {
|
||||
return unless defined $entry->{$_}
|
||||
};
|
||||
|
||||
my $dbh = db::connect($config);
|
||||
|
||||
@@ -525,10 +521,9 @@ sub delete ($$) {
|
||||
sub getDatesWithoutEvent ($$) {
|
||||
my ($config, $options) = @_;
|
||||
|
||||
return unless defined $options->{project_id};
|
||||
return unless defined $options->{studio_id};
|
||||
return unless defined $options->{from};
|
||||
return unless defined $options->{till};
|
||||
for ('project_id', 'studio_id', 'form', 'till') {
|
||||
return unless defined $options->{$_}
|
||||
};
|
||||
|
||||
my $dbh = db::connect($config);
|
||||
my $cond = $options->{series_id} ? 'and sd.series_id = ?' : '';
|
||||
|
||||
Reference in New Issue
Block a user