Code Duplication    Length = 9-9 lines in 2 locations

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

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