Code Duplication    Length = 9-9 lines in 2 locations

main/inc/lib/agenda.lib.php 2 locations

@@ 2982-2990 (lines=9) @@
2979
            $sql = " SELECT * FROM ".$tbl_global_agenda." WHERE start_date>='".$start_filter."' AND start_date<='".$end_filter."' AND  access_url_id = $current_access_url_id ";
2980
        }
2981
        // 3. creating the SQL statement for getting the personal agenda items in DAY view
2982
        if ($type == "day_view") { // we are in day view
2983
            // we could use mysql date() function but this is only available from 4.1 and higher
2984
            $start_filter = $year."-".$month."-".$day." 00:00:00";
2985
            $start_filter = api_get_utc_datetime($start_filter);
2986
2987
            $end_filter = $year."-".$month."-".$day." 23:59:59";
2988
            $end_filter = api_get_utc_datetime($end_filter);
2989
            $sql = " SELECT * FROM ".$tbl_global_agenda." WHERE start_date>='".$start_filter."' AND start_date<='".$end_filter."'  AND  access_url_id = $current_access_url_id";
2990
        }
2991
2992
        $result = Database::query($sql);
2993
@@ 3106-3114 (lines=9) @@
3103
            $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'";
3104
        }
3105
        // 3. creating the SQL statement for getting the personal agenda items in DAY view
3106
        if ($type == "day_view") {
3107
            // we are in day view
3108
            // we could use mysql date() function but this is only available from 4.1 and higher
3109
            $start_filter = $year."-".$month."-".$day." 00:00:00";
3110
            $start_filter  = api_get_utc_datetime($start_filter);
3111
            $end_filter = $year."-".$month."-".$day." 23:59:59";
3112
            $end_filter  = api_get_utc_datetime($end_filter);
3113
            $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'";
3114
        }
3115
3116
        $result = Database::query($sql);
3117
        while ($item = Database::fetch_array($result, 'ASSOC')) {