Code Duplication    Length = 12-15 lines in 3 locations

class/oledrion_caddy.php 1 location

@@ 473-486 (lines=14) @@
470
     * @param  integer $product_id Identifiant du produit
471
     * @return array   Les ID des commandes dans lesquelles ce produit a été commandé
472
     */
473
    public function getCommandIdFromProduct($product_id)
474
    {
475
        $ret    = array();
476
        $sql    = 'SELECT caddy_cmd_id FROM ' . $this->table . ' WHERE caddy_product_id=' . (int)$product_id;
477
        $result = $this->db->query($sql);
478
        if (!$result) {
479
            return $ret;
480
        }
481
        while ($myrow = $this->db->fetchArray($result)) {
482
            $ret[] = $myrow['caddy_cmd_id'];
483
        }
484
485
        return $ret;
486
    }
487
488
    /**
489
     * Retourne un caddy à partir de son mot de passe

class/oledrion_manufacturer.php 1 location

@@ 211-225 (lines=15) @@
208
     *
209
     * @return array l'alphabet des lettres utilisées !
210
     */
211
    public function getAlphabet()
212
    {
213
        global $myts;
214
        $ret    = array();
215
        $sql    = 'SELECT DISTINCT (UPPER(SUBSTRING(manu_name, 1, 1))) as oneletter FROM ' . $this->table;
216
        $result = $this->db->query($sql);
217
        if (!$result) {
218
            return $ret;
219
        }
220
        while ($myrow = $this->db->fetchArray($result)) {
221
            $ret[] = $myts->htmlSpecialChars($myrow['oneletter']);
222
        }
223
224
        return $ret;
225
    }
226
227
    /**
228
     * Supprime un fabricant et tout ce qui est relatif

class/oledrion_votedata.php 1 location

@@ 70-81 (lines=12) @@
67
     * @param  integer $sumRating  Variable passée par référence et devant contenir le cumul des votes
68
     * @return none    Rien
69
     */
70
    public function getCountRecordSumRating($product_id, &$totalVotes, &$sumRating)
71
    {
72
        $sql    = 'SELECT count( * ) AS cpt, sum( vote_rating ) AS sum_rating FROM ' . $this->table . ' WHERE vote_product_id = ' . (int)$product_id;
73
        $result = $this->db->query($sql);
74
        if (!$result) {
75
            return 0;
76
        } else {
77
            $myrow      = $this->db->fetchArray($result);
78
            $totalVotes = $myrow['cpt'];
79
            $sumRating  = $myrow['sum_rating'];
80
        }
81
    }
82
83
    /**
84
     * Returns the (x) last votes