Code Duplication    Length = 7-7 lines in 3 locations

class/oledrion_products.php 3 locations

@@ 1288-1294 (lines=7) @@
1285
            $tblTmp   = array();
1286
            $criteria = new Criteria('pm_product_id', $originalProduct->getVar('product_id'), '=');
1287
            $tblTmp   = $h_oledrion_productsmanu->getObjects($criteria);
1288
            foreach ($tblTmp as $productAuthor) {
1289
                $newProductAuthor = $productAuthor->xoopsClone();
1290
                $newProductAuthor->setVar('pm_product_id', $newProductId);
1291
                $newProductAuthor->setVar('pm_id', 0);
1292
                $newProductAuthor->setNew();
1293
                $h_oledrion_productsmanu->insert($newProductAuthor, true);
1294
            }
1295
1296
            // Copie des produits relatifs
1297
            $tblTmp   = array();
@@ 1300-1306 (lines=7) @@
1297
            $tblTmp   = array();
1298
            $criteria = new Criteria('related_product_id', $originalProduct->getVar('product_id'), '=');
1299
            $tblTmp   = $h_oledrion_related->getObjects($criteria);
1300
            foreach ($tblTmp as $related) {
1301
                $newRelated = $related->xoopsClone();
1302
                $newRelated->setVar('related_product_id', $newProductId);
1303
                $newRelated->setVar('related_id', 0);
1304
                $newRelated->setNew();
1305
                $h_oledrion_related->insert($newRelated, true);
1306
            }
1307
1308
            // Copie des attributs
1309
            if ($oledrionHandlers->h_oledrion_attributes->getProductAttributesCount($originalProduct->product_id) > 0) {
@@ 1312-1318 (lines=7) @@
1309
            if ($oledrionHandlers->h_oledrion_attributes->getProductAttributesCount($originalProduct->product_id) > 0) {
1310
                $criteria = new Criteria('attribute_product_id', $originalProduct->product_id, '=');
1311
                $tblTmp   = $oledrionHandlers->h_oledrion_attributes->getObjects($criteria);
1312
                foreach ($tblTmp as $attribute) {
1313
                    $newAttribute = $attribute->xoopsClone();
1314
                    $newAttribute->setVar('attribute_product_id', $newProductId);
1315
                    $newAttribute->setVar('attribute_id', 0);
1316
                    $newAttribute->setNew();
1317
                    $oledrionHandlers->h_oledrion_attributes->insert($newAttribute, true);
1318
                }
1319
            }
1320
1321
            return $newProduct;