Code Duplication    Length = 21-23 lines in 4 locations

admin/actions/discounts.php 1 location

@@ 346-366 (lines=21) @@
343
        break;
344
345
    // ****************************************************************************************************************
346
    case 'delete': // Suppression d'une réduction
347
        // ****************************************************************************************************************
348
        xoops_cp_header();
349
        $id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
350
        if (empty($id)) {
351
            OledrionUtility::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
352
        }
353
        $opRedirect = 'discounts';
354
        $item       = $h_oledrion_discounts->get($id);
355
        if (is_object($item)) {
356
            $res = $h_oledrion_discounts->delete($item, true);
357
            if ($res) {
358
                OledrionUtility::updateCache();
359
                OledrionUtility::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2);
360
            } else {
361
                OledrionUtility::redirect(_AM_OLEDRION_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5);
362
            }
363
        } else {
364
            OledrionUtility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5);
365
        }
366
        break;
367
}
368

admin/actions/files.php 1 location

@@ 187-207 (lines=21) @@
184
        break;
185
186
    // ****************************************************************************************************************
187
    case 'delete': // Suppression d'un fichier
188
        // ****************************************************************************************************************
189
        xoops_cp_header();
190
        $id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
191
        if (empty($id)) {
192
            OledrionUtility::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
193
        }
194
        $item = null;
195
        $item = $h_oledrion_files->get($id);
196
        if (is_object($item)) {
197
            $res = $h_oledrion_files->deleteAttachedFile($item);
198
            if ($res) {
199
                OledrionUtility::updateCache();
200
                OledrionUtility::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2);
201
            } else {
202
                OledrionUtility::redirect(_AM_OLEDRION_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5);
203
            }
204
        } else {
205
            OledrionUtility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5);
206
        }
207
        break;
208
}
209

admin/actions/packing.php 1 location

@@ 179-201 (lines=23) @@
176
177
        break;
178
179
    case 'confdelete':
180
181
        xoops_cp_header();
182
        $id = isset($_POST['id']) ? (int)$_POST['id'] : 0;
183
        if (empty($id)) {
184
            OledrionUtility::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
185
        }
186
        $opRedirect = 'packing';
187
188
        $item = null;
189
        $item = $h_oledrion_packing->get($id);
190
        if (is_object($item)) {
191
            $res = $h_oledrion_packing->delete($item);
192
            if ($res) {
193
                OledrionUtility::updateCache();
194
                OledrionUtility::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2);
195
            } else {
196
                OledrionUtility::redirect(_AM_OLEDRION_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5);
197
            }
198
        } else {
199
            OledrionUtility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5);
200
        }
201
        break;
202
}
203

admin/actions/payment.php 1 location

@@ 200-222 (lines=23) @@
197
198
        break;
199
200
    case 'confdelete':
201
202
        xoops_cp_header();
203
        $id = isset($_POST['id']) ? (int)$_POST['id'] : 0;
204
        if (empty($id)) {
205
            OledrionUtility::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
206
        }
207
        $opRedirect = 'payment';
208
209
        $item = null;
210
        $item = $h_oledrion_payment->get($id);
211
        if (is_object($item)) {
212
            $res = $h_oledrion_payment->delete($item);
213
            if ($res) {
214
                OledrionUtility::updateCache();
215
                OledrionUtility::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2);
216
            } else {
217
                OledrionUtility::redirect(_AM_OLEDRION_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5);
218
            }
219
        } else {
220
            OledrionUtility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5);
221
        }
222
        break;
223
}
224