From c38a1c33c03ea322c0518702e3c89a4a85a45e75 Mon Sep 17 00:00:00 2001 From: Milan Date: Wed, 26 Dec 2018 21:36:25 +0100 Subject: [PATCH] show only published events at calendar view --- lib/calcms/calendar.pm | 3 ++- lib/calcms/events.pm | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/calcms/calendar.pm b/lib/calcms/calendar.pm index d5fcdb5..e6a4212 100644 --- a/lib/calcms/calendar.pm +++ b/lib/calcms/calendar.pm @@ -8,6 +8,7 @@ use Date::Calc(); use template(); use cache(); +use events(); use base 'Exporter'; our @EXPORT_OK = qw(init get_cached_or_render get render get_calendar_weeks configure_cache); @@ -203,7 +204,7 @@ sub get { my $woy_year = undef; for my $date (@$week) { - my ( $year, $month, $day ) = split( /\-/, $date ); + my ( $year, $month, $day ) = split( /\-/, $date, 3 ); my $weekday = 0; my $day_result = undef; diff --git a/lib/calcms/events.pm b/lib/calcms/events.pm index 39b1d5d..6e0390f 100644 --- a/lib/calcms/events.pm +++ b/lib/calcms/events.pm @@ -1414,6 +1414,7 @@ sub get_by_date_range { $end = time::add_hours_to_datetime( $end, $day_starting_hour ); my $conditions = []; + push @$conditions, 'published = 1'; push @$conditions, 'start between ? and ?'; my $bind_values = [ $start, $end ]; @@ -1430,7 +1431,7 @@ sub get_by_date_range { where $conditions }; - #print STDERR Dumper($query); + #print STDERR Dumper($query) . Dumper($bind_values); my $events = db::get( $dbh, $query, $bind_values );