Code Duplication    Length = 6-6 lines in 3 locations

class/oledrion_products.php 3 locations

@@ 1242-1247 (lines=6) @@
1239
        $newProduct->setNew();
1240
1241
        // Copie des 2 images
1242
        if (xoops_trim($originalProduct->getVar('product_image_url')) != '') {
1243
            $resCopy = Oledrion_utils::duplicateFile(OLEDRION_PICTURES_PATH, $originalProduct->getVar('product_image_url'));
1244
            if ($resCopy !== false) {
1245
                $newProduct->setVar('product_image_url', $resCopy);
1246
            }
1247
        }
1248
        if (xoops_trim($originalProduct->getVar('product_thumb_url')) != '') {
1249
            $resCopy = Oledrion_utils::duplicateFile(OLEDRION_PICTURES_PATH, $originalProduct->getVar('product_thumb_url'));
1250
            if ($resCopy !== false) {
@@ 1248-1253 (lines=6) @@
1245
                $newProduct->setVar('product_image_url', $resCopy);
1246
            }
1247
        }
1248
        if (xoops_trim($originalProduct->getVar('product_thumb_url')) != '') {
1249
            $resCopy = Oledrion_utils::duplicateFile(OLEDRION_PICTURES_PATH, $originalProduct->getVar('product_thumb_url'));
1250
            if ($resCopy !== false) {
1251
                $newProduct->setVar('product_thumb_url', $resCopy);
1252
            }
1253
        }
1254
1255
        // Copie du fichier attaché
1256
        if (xoops_trim($originalProduct->getVar('product_attachment')) != '') {
@@ 1256-1261 (lines=6) @@
1253
        }
1254
1255
        // Copie du fichier attaché
1256
        if (xoops_trim($originalProduct->getVar('product_attachment')) != '') {
1257
            $resCopy = Oledrion_utils::duplicateFile(OLEDRION_ATTACHED_FILES_PATH, $originalProduct->getVar('product_attachment'));
1258
            if ($resCopy !== false) {
1259
                $newProduct->setVar('product_attachment', $resCopy);
1260
            }
1261
        }
1262
1263
        $res = $this->insert($newProduct, true);
1264
        if ($res) {