Code Duplication    Length = 7-7 lines in 3 locations

caffeinated/admin/new/pricing/espresso_events_Pricing_Hooks.class.php 1 location

@@ 568-574 (lines=7) @@
565
                    // if they aren't different then we go ahead and modify existing ticket.
566
                    $create_new_TKT = $tickets_sold > 0 && $ticket_price !== $ticket->price() && ! $ticket->deleted();
567
                    // set new values
568
                    foreach ($TKT_values as $field => $value) {
569
                        if ($field === 'TKT_qty') {
570
                            $ticket->set_qty($value);
571
                        } else {
572
                            $ticket->set($field, $value);
573
                        }
574
                    }
575
                    // if $create_new_TKT is false then we can safely update the existing ticket.
576
                    // Otherwise we have to create a new ticket.
577
                    if ($create_new_TKT) {

admin_pages/events/Events_Admin_Page.core.php 2 locations

@@ 1290-1296 (lines=7) @@
1287
                    $TKT->set_date_format($incoming_date_formats[0]);
1288
                    $TKT->set_time_format($incoming_date_formats[1]);
1289
                    // set new values
1290
                    foreach ($TKT_values as $field => $value) {
1291
                        if ($field == 'TKT_qty') {
1292
                            $TKT->set_qty($value);
1293
                        } else {
1294
                            $TKT->set($field, $value);
1295
                        }
1296
                    }
1297
                    // if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1298
                    if ($create_new_TKT) {
1299
                        // archive the old ticket first
@@ 1326-1332 (lines=7) @@
1323
                    $TKT->set_time_format($incoming_date_formats[1]);
1324
                    $TKT->set_timezone($evtobj->get_timezone());
1325
                    // set new values
1326
                    foreach ($TKT_values as $field => $value) {
1327
                        if ($field == 'TKT_qty') {
1328
                            $TKT->set_qty($value);
1329
                        } else {
1330
                            $TKT->set($field, $value);
1331
                        }
1332
                    }
1333
                    $update_prices = true;
1334
                }
1335
            }