Code Duplication    Length = 19-20 lines in 2 locations

admin/actions/attributes.php 1 location

@@ 187-205 (lines=19) @@
184
        break;
185
186
    // ****************************************************************************************************************
187
    case 'copy': // Dupliquer un attribut
188
        // ****************************************************************************************************************
189
        xoops_cp_header();
190
        $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
191
        if (empty($id)) {
192
            oledrion_utils::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
193
        }
194
        $attribute = null;
195
        $attribute = $oledrion_handlers->h_oledrion_attributes->get($id);
196
        if (is_object($attribute)) {
197
            $newAttribute = $oledrion_handlers->h_oledrion_attributes->cloneAttribute($attribute);
198
            $newAttributeId = $newAttribute->attribute_id;
199
            if ($newAttribute !== false) {
200
                oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=' . $operation . "&action=edit&id=" . $newAttributeId, 2);
201
            } else {
202
                oledrion_utils::redirect(_AM_OLEDRION_SAVE_PB, $baseurl . '?op=' . $operation, 5);
203
            }
204
        }
205
        break;
206
207
    // ****************************************************************************************************************
208
    case 'delete': // Suppression d'un attribut

admin/actions/products.php 1 location

@@ 717-736 (lines=20) @@
714
        break;
715
716
    // ****************************************************************************************************************
717
    case 'copy': // Copier un produit
718
        // ****************************************************************************************************************
719
        xoops_cp_header();
720
        $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
721
        if (empty($id)) {
722
            oledrion_utils::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
723
        }
724
        $opRedirect = 'products';
725
        $product = null;
726
        $product = $h_oledrion_products->get($id);
727
        if (is_object($product)) {
728
            $newProduct = $h_oledrion_products->cloneProduct($product);
729
            $newProductId = $newProduct->product_id;
730
            if ($newProduct !== false) {
731
                oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=' . $opRedirect . "&action=edit&id=" . $newProductId, 2);
732
            } else {
733
                oledrion_utils::redirect(_AM_OLEDRION_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5);
734
            }
735
        }
736
        break;
737
738
    // ****************************************************************************************************************
739
    case 'confdelete': // Confirmation de la suppression d'un produit