Code Duplication    Length = 9-9 lines in 2 locations

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

@@ 3450-3458 (lines=9) @@
3447
            $sql = " SELECT * FROM ".$tbl_global_agenda." WHERE start_date>='".$start_filter."' AND start_date<='".$end_filter."' AND  access_url_id = $current_access_url_id ";
3448
        }
3449
        // 3. creating the SQL statement for getting the personal agenda items in DAY view
3450
        if ($type == "day_view") { // we are in day view
3451
            // we could use mysql date() function but this is only available from 4.1 and higher
3452
            $start_filter = $year."-".$month."-".$day." 00:00:00";
3453
            $start_filter = api_get_utc_datetime($start_filter);
3454
3455
            $end_filter = $year."-".$month."-".$day." 23:59:59";
3456
            $end_filter = api_get_utc_datetime($end_filter);
3457
            $sql = " SELECT * FROM ".$tbl_global_agenda." WHERE start_date>='".$start_filter."' AND start_date<='".$end_filter."'  AND  access_url_id = $current_access_url_id";
3458
        }
3459
3460
        $result = Database::query($sql);
3461
@@ 3584-3592 (lines=9) @@
3581
            $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'";
3582
        }
3583
        // 3. creating the SQL statement for getting the personal agenda items in DAY view
3584
        if ($type == "day_view") {
3585
            // we are in day view
3586
            // we could use mysql date() function but this is only available from 4.1 and higher
3587
            $start_filter = $year."-".$month."-".$day." 00:00:00";
3588
            $start_filter = api_get_utc_datetime($start_filter);
3589
            $end_filter = $year."-".$month."-".$day." 23:59:59";
3590
            $end_filter = api_get_utc_datetime($end_filter);
3591
            $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'";
3592
        }
3593
3594
        $result = Database::query($sql);
3595
        while ($item = Database::fetch_array($result, 'ASSOC')) {