Code Duplication    Length = 13-13 lines in 2 locations

web_interface/astpp/application/libraries/astpp/common.php 2 locations

@@ 55-67 (lines=13) @@
52
53
    function find_uniq_rendno($size = '', $field = '', $tablename = '') {
54
55
        if ($tablename != '') {
56
            $accounttype_array = array();
57
            $uname = rand(pow(10, $size - 1), pow(10, $size) - 1);
58
            $where = array($field => $uname);
59
            $acc_result = $this->CI->db_model->getSelect('Count(*) as count', $tablename, $where);
60
            $acc_result = $acc_result->result();
61
            while ($acc_result[0]->count != 0) {
62
                $uname = rand(pow(10, $size - 1), pow(10, $size) - 1);
63
                $acc_result = $this->CI->db_model->getSelect('Count(*) as count', $tablename, $where);
64
            }
65
        } else {
66
            $uname = rand(pow(10, $size - 1), pow(10, $size) - 1);
67
        }
68
        return $uname;
69
    }
70
@@ 72-84 (lines=13) @@
69
    }
70
71
    function find_uniq_rendno_customer($size = '', $field = '', $tablename = '') {
72
        if ($tablename != '') {
73
            $accounttype_array = array();
74
            $uname = rand(pow(10, $size - 1), pow(10, $size) - 1);
75
            $where = array($field => $uname);
76
            $acc_result = $this->CI->db_model->getSelect('Count(*) as count', $tablename, $where);
77
            $acc_result = $acc_result->result();
78
            while ($acc_result[0]->count != 0) {
79
                $uname = rand(pow(10, $size - 1), pow(10, $size) - 1);
80
                $acc_result = $this->CI->db_model->getSelect('Count(*) as count', $tablename, $where);
81
            }
82
        } else {
83
            $uname = rand(pow(10, $size - 1), pow(10, $size) - 1);
84
        }
85
        $start_prifix_value = common_model::$global_config['system_config']['startingdigit'];
86
        if ($tablename == 'accounts' && $start_prifix_value != 0) {
87
            $length = strlen($start_prifix_value);