Code Duplication    Length = 26-26 lines in 2 locations

class/order.php 2 locations

@@ 581-606 (lines=26) @@
578
     * @param $order_id
579
     * @return array
580
     */
581
    public function GetOrderRooms($order_id)
582
    {
583
        if (!$order_id) {
584
            return $order_id;
585
        }
586
        global $xoopsDB;
587
        $sql = "SELECT mor.room_id , mor.room_count ,mor.room_date , r.room_name , h.hotel_id , 
588
            rp.room_is_today_special,rp.room_price,rp.room_advisory_range_small,rp.room_advisory_range_max ,
589
            h.hotel_name,hotel_city_id ";
590
        $sql .= "FROM " . $xoopsDB->prefix("martin_order_room") . " mor ";
591
592
        $sql .= " LEFT JOIN " . $xoopsDB->prefix("martin_room") . " r ON ( r.room_id = mor.room_id ) ";
593
        $sql .= " LEFT JOIN " . $xoopsDB->prefix("martin_room_price") . " rp ON ( r.room_id = rp.room_id AND mor.room_date = rp.room_date ) ";
594
        $sql .= " LEFT JOIN " . $xoopsDB->prefix("martin_hotel") . " h ON ( r.hotel_id = h.hotel_id ) ";
595
        $sql .= " WHERE 1 = 1 ";
596
        $sql .= $order_id > 0 ? " AND mor.order_id = $order_id " : " ";
597
        $sql .= " Group by mor.room_date order by mor.room_id DESC ";
598
        //echo '<pre>'.$sql;exit;
599
        $result = $xoopsDB->query($sql);
600
        $rows   = array();
601
        while ($row = $xoopsDB->fetchArray($result)) {
602
            $rows[] = $row;
603
        }
604
605
        return $rows;
606
    }
607
608
    /**
609
     * @get       order query rooms
@@ 618-643 (lines=26) @@
615
     * @param $order_id
616
     * @return array
617
     */
618
    public function GetOrderQueryRooms($order_id)
619
    {
620
        if (!$order_id) {
621
            return $order_id;
622
        }
623
        global $xoopsDB;
624
        $sql = "SELECT mor.room_id , mor.room_count ,mor.room_date , mor.room_price , r.* , 
625
            rp.room_is_today_special,rp.room_advisory_range_small,rp.room_advisory_range_max ,
626
            h.hotel_name,hotel_city_id ";
627
        $sql .= "FROM " . $xoopsDB->prefix("martin_order_query_room") . " mor ";
628
629
        $sql .= " LEFT JOIN " . $xoopsDB->prefix("martin_room") . " r ON ( r.room_id = mor.room_id ) ";
630
        $sql .= " LEFT JOIN " . $xoopsDB->prefix("martin_room_price") . " rp ON ( r.room_id = rp.room_id AND mor.room_date = rp.room_date ) ";
631
        $sql .= " LEFT JOIN " . $xoopsDB->prefix("martin_hotel") . " h ON ( r.hotel_id = h.hotel_id ) ";
632
        $sql .= " WHERE 1 = 1 ";
633
        $sql .= $order_id > 0 ? " AND mor.order_id = $order_id " : " ";
634
        $sql .= " Group by mor.room_date order by mor.room_id DESC ";
635
        //echo '<pre>'.$sql;exit;
636
        $result = $xoopsDB->query($sql);
637
        $rows   = array();
638
        while ($row = $xoopsDB->fetchArray($result)) {
639
            $rows[] = $row;
640
        }
641
642
        return $rows;
643
    }
644
645
    /**
646
     * @得到类别列表