Code Duplication    Length = 25-25 lines in 2 locations

class/auction.php 1 location

@@ 488-512 (lines=25) @@
485
     * @param $isNew
486
     * @return bool
487
     */
488
    public function InsertAuctionRoom($auction_id, $room_ids, $room_counts, $isNew)
489
    {
490
        global $xoopsDB;
491
        if (!$auction_id || !is_array($room_ids)) {
492
            // delete data
493
            $sql = "delete FROM " . $xoopsDB->prefix("martin_auction") . " WHERE auction_id = " . $auction_id;
494
            if ($auction_id > 0) {
495
                $xoopsDB->query($sql);
496
            }
497
498
            return false;
499
        }
500
        $dsql = 'delete FROM ' . $xoopsDB->prefix("martin_auction_room") . " WHERE auction_id = $auction_id";
501
        $xoopsDB->query($dsql);
502
503
        $sql = "insert INTO " . $xoopsDB->prefix("martin_auction_room") . " (auction_id,room_id,room_count) VALUES ";
504
        foreach ($room_ids as $key => $room_id) {
505
            $room_count = $room_counts[$key];
506
            $sql .= $prefix . "($auction_id,$room_id,$room_count)";
507
            $prefix = ",";
508
        }
509
510
        //echo $sql;
511
        return $xoopsDB->query($sql);
512
    }
513
514
    /**
515
     * @get       room by hotel

class/group.php 1 location

@@ 466-490 (lines=25) @@
463
     * @param $isNew
464
     * @return bool
465
     */
466
    public function InsertGroupRoom($group_id, $room_ids, $room_counts, $isNew)
467
    {
468
        global $xoopsDB;
469
        if (!$group_id || !is_array($room_ids)) {
470
            // delete data
471
            $sql = "delete FROM " . $xoopsDB->prefix("martin_group") . " WHERE group_id = " . $group_id;
472
            if ($group_id > 0) {
473
                $xoopsDB->query($sql);
474
            }
475
476
            return false;
477
        }
478
        $dsql = 'delete FROM ' . $xoopsDB->prefix("martin_group_room") . " WHERE group_id = $group_id";
479
        $xoopsDB->query($dsql);
480
481
        $sql = "insert INTO " . $xoopsDB->prefix("martin_group_room") . " (group_id,room_id,room_count) VALUES ";
482
        foreach ($room_ids as $key => $room_id) {
483
            $room_count = $room_counts[$key];
484
            $sql .= $prefix . "($group_id,$room_id,$room_count)";
485
            $prefix = ",";
486
        }
487
488
        //echo $sql;
489
        return $xoopsDB->query($sql);
490
    }
491
492
    /**
493
     * @get       room by hotel