Code Duplication    Length = 9-9 lines in 2 locations

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

@@ 2918-2926 (lines=9) @@
2915
            $sql = " SELECT * FROM ".$tbl_global_agenda." WHERE start_date>='".$start_filter."' AND start_date<='".$end_filter."' AND  access_url_id = $current_access_url_id ";
2916
        }
2917
        // 3. creating the SQL statement for getting the personal agenda items in DAY view
2918
        if ($type == "day_view") { // we are in day view
2919
            // we could use mysql date() function but this is only available from 4.1 and higher
2920
            $start_filter = $year."-".$month."-".$day." 00:00:00";
2921
            $start_filter = api_get_utc_datetime($start_filter);
2922
2923
            $end_filter = $year."-".$month."-".$day." 23:59:59";
2924
            $end_filter = api_get_utc_datetime($end_filter);
2925
            $sql = " SELECT * FROM ".$tbl_global_agenda." WHERE start_date>='".$start_filter."' AND start_date<='".$end_filter."'  AND  access_url_id = $current_access_url_id";
2926
        }
2927
2928
        $result = Database::query($sql);
2929
@@ 3042-3050 (lines=9) @@
3039
            $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'";
3040
        }
3041
        // 3. creating the SQL statement for getting the personal agenda items in DAY view
3042
        if ($type == "day_view") {
3043
            // we are in day view
3044
            // we could use mysql date() function but this is only available from 4.1 and higher
3045
            $start_filter = $year."-".$month."-".$day." 00:00:00";
3046
            $start_filter  = api_get_utc_datetime($start_filter);
3047
            $end_filter = $year."-".$month."-".$day." 23:59:59";
3048
            $end_filter  = api_get_utc_datetime($end_filter);
3049
            $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'";
3050
        }
3051
3052
        $result = Database::query($sql);
3053
        while ($item = Database::fetch_array($result, 'ASSOC')) {