Code Duplication    Length = 17-18 lines in 2 locations

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());

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

@@ 1364-1380 (lines=17) @@
1361
    {
1362
        $success = 1;
1363
        // checkboxes?
1364
        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1365
            // if array has more than one element then success message should be plural
1366
            $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1367
            // cycle thru the boxes
1368
            foreach ($this->_req_data['checkbox'] as $TKT_ID) {
1369
                // delete
1370
                if (! $this->_delete_the_ticket($TKT_ID)) {
1371
                    $success = 0;
1372
                }
1373
            }
1374
        } else {
1375
            // grab single id and trash
1376
            $TKT_ID = absint($this->_req_data['TKT_ID']);
1377
            if (! $this->_delete_the_ticket($TKT_ID)) {
1378
                $success = 0;
1379
            }
1380
        }
1381
        $action_desc = 'deleted';
1382
        // fail safe.  If the default ticket count === 1 then we need to redirect to event overview.
1383
        $ticket_count = EEM_Ticket::instance()->count_deleted_and_undeleted(