Code Duplication    Length = 18-18 lines in 2 locations

caffeinated/admin/extend/events/Extend_Events_Admin_Page.core.php 1 location

@@ 1249-1266 (lines=18) @@
1246
    {
1247
        $success = 1;
1248
        // checkboxes?
1249
        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1250
            // if array has more than one element then success message should be plural
1251
            $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1252
            // cycle thru the boxes
1253
            while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
1254
                // delete
1255
                if (! $this->_delete_the_ticket($TKT_ID)) {
1256
                    $success = 0;
1257
                }
1258
            }
1259
        } else {
1260
            // grab single id and trash
1261
            $TKT_ID = absint($this->_req_data['TKT_ID']);
1262
            if (! $this->_delete_the_ticket($TKT_ID)) {
1263
                $success = 0;
1264
            }
1265
        }
1266
        $action_desc = 'deleted';
1267
        $query_args = array(
1268
            'action' => 'ticket_list_table',
1269
            'status' => 'trashed',

caffeinated/admin/new/tickets/Tickets_Admin_Page.core.php 1 location

@@ 291-308 (lines=18) @@
288
        $TKT = EEM_Ticket::instance();
289
290
        // checkboxes?
291
        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
292
            // if array has more than one element then success message should be plural
293
            $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
294
295
            // cycle thru the boxes
296
            while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
297
                // delete
298
                if (! $this->_delete_the_ticket($TKT_ID)) {
299
                    $success = 0;
300
                }
301
            }
302
        } else {
303
            // grab single id and trash
304
            $TKT_ID = absint($this->_req_data['TKT_ID']);
305
            if (! $this->_delete_the_ticket($TKT_ID)) {
306
                $success = 0;
307
            }
308
        }
309
310
        $action_desc = 'deleted';
311
        $this->_redirect_after_action($success, 'Tickets', $action_desc, array());