Code Duplication    Length = 20-20 lines in 9 locations

admin/actions/categories.php 1 location

@@ 121-140 (lines=20) @@
118
        // ****************************************************************************************************************
119
        xoops_cp_header();
120
121
        if ($action === 'edit') {
122
            $title = _AM_OLEDRION_EDIT_CATEG;
123
            $id    = isset($_POST['id']) ? (int)$_POST['id'] : 0;
124
            if (empty($id)) {
125
                OledrionUtility::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
126
            }
127
            // Item exits ?
128
            $item = null;
129
            $item = $h_oledrion_cat->get($id);
130
            if (!is_object($item)) {
131
                OledrionUtility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
132
            }
133
            $edit         = true;
134
            $label_submit = _AM_OLEDRION_MODIFY;
135
        } else {
136
            $title        = _AM_OLEDRION_ADD_CATEG;
137
            $item         = $h_oledrion_cat->create(true);
138
            $label_submit = _AM_OLEDRION_ADD;
139
            $edit         = false;
140
        }
141
        $tbl_categories = $h_oledrion_cat->getAllCategories(new Oledrion_parameters());
142
        $mytree         = new XoopsObjectTree($tbl_categories, 'cat_cid', 'cat_pid');
143

admin/actions/delivery.php 1 location

@@ 70-89 (lines=20) @@
67
    case 'add':
68
    case 'edit':
69
        xoops_cp_header();
70
        if ($action === 'edit') {
71
            $title = _AM_OLEDRION_DELIVERY_EDIT;
72
            $id    = isset($_GET['id']) ? (int)$_GET['id'] : 0;
73
            if (empty($id)) {
74
                OledrionUtility::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
75
            }
76
            // Item exits ?
77
            $item = null;
78
            $item = $h_oledrion_delivery->get($id);
79
            if (!is_object($item)) {
80
                OledrionUtility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
81
            }
82
            $edit         = true;
83
            $label_submit = _AM_OLEDRION_MODIFY;
84
        } else {
85
            $title        = _AM_OLEDRION_DELIVERY_ADD;
86
            $item         = $h_oledrion_delivery->create(true);
87
            $label_submit = _AM_OLEDRION_ADD;
88
            $edit         = false;
89
        }
90
        $sform = new XoopsThemeForm($title, 'frmadddelivery', $baseurl);
91
        $sform->addElement(new XoopsFormHidden('op', 'delivery'));
92
        $sform->addElement(new XoopsFormHidden('action', 'save'));

admin/actions/discounts.php 1 location

@@ 89-108 (lines=20) @@
86
87
        xoops_cp_header();
88
        //oledrion_adminMenu(7);
89
        if ($action === 'edit') {
90
            $title = _AM_OLEDRION_EDIT_DISCOUNT;
91
            $id    = isset($_GET['id']) ? (int)$_GET['id'] : 0;
92
            if (empty($id)) {
93
                OledrionUtility::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
94
            }
95
            // Item exits ?
96
            $item = null;
97
            $item = $h_oledrion_discounts->get($id);
98
            if (!is_object($item)) {
99
                OledrionUtility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
100
            }
101
            $edit         = true;
102
            $label_submit = _AM_OLEDRION_MODIFY;
103
        } else {
104
            $title        = _AM_OLEDRION_ADD_DSICOUNT;
105
            $item         = $h_oledrion_discounts->create(true);
106
            $label_submit = _AM_OLEDRION_ADD;
107
            $edit         = false;
108
        }
109
110
        require_once XOOPS_ROOT_PATH . '/class/template.php';
111
        global $xoopsTpl;

admin/actions/files.php 1 location

@@ 86-105 (lines=20) @@
83
    case 'edit': // Edition d'un fichier
84
        // ****************************************************************************************************************
85
        xoops_cp_header();
86
        if ($action === 'edit') {
87
            $title = _AM_OLEDRION_EDIT_FILE;
88
            $id    = isset($_GET['id']) ? (int)$_GET['id'] : 0;
89
            if (empty($id)) {
90
                OledrionUtility::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
91
            }
92
            // Item exits ?
93
            $item = null;
94
            $item = $h_oledrion_files->get($id);
95
            if (!is_object($item)) {
96
                OledrionUtility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
97
            }
98
            $edit         = true;
99
            $label_submit = _AM_OLEDRION_MODIFY;
100
        } else {
101
            $title        = _AM_OLEDRION_ADD_FILE;
102
            $item         = $h_oledrion_files->create(true);
103
            $label_submit = _AM_OLEDRION_ADD;
104
            $edit         = false;
105
        }
106
        $products = array();
107
        $products = $h_oledrion_products->getList();
108
        $sform    = new XoopsThemeForm($title, 'frmaddfile', $baseurl);

admin/actions/manufacturers.php 1 location

@@ 87-106 (lines=20) @@
84
    case 'edit': // Edition d'un fabricant
85
        // ****************************************************************************************************************
86
        xoops_cp_header();
87
        if ($action === 'edit') {
88
            $title = _AM_OLEDRION_EDIT_MANUFACTURER;
89
            $id    = isset($_GET['id']) ? (int)$_GET['id'] : 0;
90
            if (empty($id)) {
91
                OledrionUtility::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
92
            }
93
            // Item exits ?
94
            $item = null;
95
            $item = $h_oledrion_manufacturer->get($id);
96
            if (!is_object($item)) {
97
                OledrionUtility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
98
            }
99
            $edit         = true;
100
            $label_submit = _AM_OLEDRION_MODIFY;
101
        } else {
102
            $title        = _AM_OLEDRION_ADD_MANUFACTURER;
103
            $item         = $h_oledrion_manufacturer->create(true);
104
            $label_submit = _AM_OLEDRION_ADD;
105
            $edit         = false;
106
        }
107
108
        $sform = new XoopsThemeForm($title, 'frmmanufacturer', $baseurl);
109
        $sform->setExtra('enctype="multipart/form-data"');

admin/actions/packing.php 1 location

@@ 70-89 (lines=20) @@
67
    case 'add':
68
    case 'edit':
69
        xoops_cp_header();
70
        if ($action === 'edit') {
71
            $title = _AM_OLEDRION_PACKING_EDIT;
72
            $id    = isset($_GET['id']) ? (int)$_GET['id'] : 0;
73
            if (empty($id)) {
74
                OledrionUtility::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
75
            }
76
            // Item exits ?
77
            $item = null;
78
            $item = $h_oledrion_packing->get($id);
79
            if (!is_object($item)) {
80
                OledrionUtility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
81
            }
82
            $edit         = true;
83
            $label_submit = _AM_OLEDRION_MODIFY;
84
        } else {
85
            $title        = _AM_OLEDRION_PACKING_ADD;
86
            $item         = $h_oledrion_packing->create(true);
87
            $label_submit = _AM_OLEDRION_ADD;
88
            $edit         = false;
89
        }
90
        $sform = new XoopsThemeForm($title, 'frmaddpacking', $baseurl);
91
        $sform->addElement(new XoopsFormHidden('op', 'packing'));
92
        $sform->addElement(new XoopsFormHidden('action', 'save'));

admin/actions/payment.php 1 location

@@ 75-94 (lines=20) @@
72
    case 'add':
73
    case 'edit':
74
        xoops_cp_header();
75
        if ($action === 'edit') {
76
            $title = _AM_OLEDRION_PAYMENT_EDIT;
77
            $id    = isset($_GET['id']) ? (int)$_GET['id'] : 0;
78
            if (empty($id)) {
79
                OledrionUtility::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
80
            }
81
            // Item exits ?
82
            $item = null;
83
            $item = $h_oledrion_payment->get($id);
84
            if (!is_object($item)) {
85
                OledrionUtility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
86
            }
87
            $edit         = true;
88
            $label_submit = _AM_OLEDRION_MODIFY;
89
        } else {
90
            $title        = _AM_OLEDRION_PAYMENT_ADD;
91
            $item         = $h_oledrion_payment->create(true);
92
            $label_submit = _AM_OLEDRION_ADD;
93
            $edit         = false;
94
        }
95
        $sform = new XoopsThemeForm($title, 'frmaddpayment', $baseurl);
96
        $sform->addElement(new XoopsFormHidden('op', 'payment'));
97
        $sform->addElement(new XoopsFormHidden('action', 'save'));

admin/actions/vat.php 1 location

@@ 69-88 (lines=20) @@
66
        // ****************************************************************************************************************
67
        xoops_cp_header();
68
        oledrion_adminMenu(2);
69
        if ($action === 'edit') {
70
            $title = _AM_OLEDRION_EDIT_VAT;
71
            $id    = isset($_GET['id']) ? (int)$_GET['id'] : 0;
72
            if (empty($id)) {
73
                OledrionUtility::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
74
            }
75
            // Item exits ?
76
            $item = null;
77
            $item = $h_oledrion_vat->get($id);
78
            if (!is_object($item)) {
79
                OledrionUtility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
80
            }
81
            $edit         = true;
82
            $label_submit = _AM_OLEDRION_MODIFY;
83
        } else {
84
            $title        = _AM_OLEDRION_ADD_VAT;
85
            $item         = $h_oledrion_vat->create(true);
86
            $label_submit = _AM_OLEDRION_ADD;
87
            $edit         = false;
88
        }
89
        $sform = new XoopsThemeForm($title, 'frmaddvat', $baseurl);
90
        $sform->addElement(new XoopsFormHidden('op', 'vat'));
91
        $sform->addElement(new XoopsFormHidden('action', 'saveedit'));

admin/actions/vendors.php 1 location

@@ 73-92 (lines=20) @@
70
    case 'edit': // Edition d'un vendeur
71
        // ****************************************************************************************************************
72
        xoops_cp_header();
73
        if ($action === 'edit') {
74
            $title = _AM_OLEDRION_EDIT_VENDOR;
75
            $id    = isset($_GET['id']) ? (int)$_GET['id'] : 0;
76
            if (empty($id)) {
77
                OledrionUtility::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
78
            }
79
            // Item exits ?
80
            $item = null;
81
            $item = $h_oledrion_vendors->get($id);
82
            if (!is_object($item)) {
83
                OledrionUtility::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
84
            }
85
            $edit         = true;
86
            $label_submit = _AM_OLEDRION_MODIFY;
87
        } else {
88
            $title        = _AM_OLEDRION_ADD_VENDOR;
89
            $item         = $h_oledrion_vendors->create(true);
90
            $label_submit = _AM_OLEDRION_ADD;
91
            $edit         = false;
92
        }
93
        $sform = new XoopsThemeForm($title, 'frmaddvendor', $baseurl);
94
        $sform->addElement(new XoopsFormHidden('op', 'vendors'));
95
        $sform->addElement(new XoopsFormHidden('action', 'saveedit'));