Code Duplication    Length = 9-9 lines in 2 locations

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

@@ 3435-3443 (lines=9) @@
3432
            $sql = " SELECT * FROM ".$tbl_global_agenda." WHERE start_date>='".$start_filter."' AND start_date<='".$end_filter."' AND  access_url_id = $current_access_url_id ";
3433
        }
3434
        // 3. creating the SQL statement for getting the personal agenda items in DAY view
3435
        if ($type == "day_view") { // we are in day view
3436
            // we could use mysql date() function but this is only available from 4.1 and higher
3437
            $start_filter = $year."-".$month."-".$day." 00:00:00";
3438
            $start_filter = api_get_utc_datetime($start_filter);
3439
3440
            $end_filter = $year."-".$month."-".$day." 23:59:59";
3441
            $end_filter = api_get_utc_datetime($end_filter);
3442
            $sql = " SELECT * FROM ".$tbl_global_agenda." WHERE start_date>='".$start_filter."' AND start_date<='".$end_filter."'  AND  access_url_id = $current_access_url_id";
3443
        }
3444
3445
        $result = Database::query($sql);
3446
@@ 3569-3577 (lines=9) @@
3566
            $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'";
3567
        }
3568
        // 3. creating the SQL statement for getting the personal agenda items in DAY view
3569
        if ($type == "day_view") {
3570
            // we are in day view
3571
            // we could use mysql date() function but this is only available from 4.1 and higher
3572
            $start_filter = $year."-".$month."-".$day." 00:00:00";
3573
            $start_filter = api_get_utc_datetime($start_filter);
3574
            $end_filter = $year."-".$month."-".$day." 23:59:59";
3575
            $end_filter = api_get_utc_datetime($end_filter);
3576
            $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'";
3577
        }
3578
3579
        $result = Database::query($sql);
3580
        while ($item = Database::fetch_array($result, 'ASSOC')) {