Code Duplication    Length = 19-20 lines in 2 locations

admin/actions/attributes.php 1 location

@@ 210-228 (lines=19) @@
207
        break;
208
209
    // ****************************************************************************************************************
210
    case 'copy': // Dupliquer un attribut
211
        // ****************************************************************************************************************
212
        xoops_cp_header();
213
        $id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
214
        if (empty($id)) {
215
            OledrionUtility::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
216
        }
217
        $attribute = null;
218
        $attribute = $oledrionHandlers->h_oledrion_attributes->get($id);
219
        if (is_object($attribute)) {
220
            $newAttribute   = $oledrionHandlers->h_oledrion_attributes->cloneAttribute($attribute);
221
            $newAttributeId = $newAttribute->attribute_id;
222
            if ($newAttribute !== false) {
223
                OledrionUtility::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=' . $operation . '&action=edit&id=' . $newAttributeId, 2);
224
            } else {
225
                OledrionUtility::redirect(_AM_OLEDRION_SAVE_PB, $baseurl . '?op=' . $operation, 5);
226
            }
227
        }
228
        break;
229
230
    // ****************************************************************************************************************
231
    case 'delete': // Suppression d'un attribut

admin/actions/products.php 1 location

@@ 847-866 (lines=20) @@
844
        break;
845
846
    // ****************************************************************************************************************
847
    case 'copy': // Copier un produit
848
        // ****************************************************************************************************************
849
        xoops_cp_header();
850
        $id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
851
        if (empty($id)) {
852
            OledrionUtility::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
853
        }
854
        $opRedirect = 'products';
855
        $product    = null;
856
        $product    = $h_oledrion_products->get($id);
857
        if (is_object($product)) {
858
            $newProduct   = $h_oledrion_products->cloneProduct($product);
859
            $newProductId = $newProduct->product_id;
860
            if ($newProduct !== false) {
861
                OledrionUtility::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=' . $opRedirect . '&action=edit&id=' . $newProductId, 2);
862
            } else {
863
                OledrionUtility::redirect(_AM_OLEDRION_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5);
864
            }
865
        }
866
        break;
867
868
    // ****************************************************************************************************************
869
    case 'confdelete': // Confirmation de la suppression d'un produit