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

@@ 1283-1289 (lines=7) @@
1280
                    $TKT->set_date_format($incoming_date_formats[0]);
1281
                    $TKT->set_time_format($incoming_date_formats[1]);
1282
                    // set new values
1283
                    foreach ($TKT_values as $field => $value) {
1284
                        if ($field == 'TKT_qty') {
1285
                            $TKT->set_qty($value);
1286
                        } else {
1287
                            $TKT->set($field, $value);
1288
                        }
1289
                    }
1290
                    // if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1291
                    if ($create_new_TKT) {
1292
                        // archive the old ticket first
@@ 1319-1325 (lines=7) @@
1316
                    $TKT->set_time_format($incoming_date_formats[1]);
1317
                    $TKT->set_timezone($evtobj->get_timezone());
1318
                    // set new values
1319
                    foreach ($TKT_values as $field => $value) {
1320
                        if ($field == 'TKT_qty') {
1321
                            $TKT->set_qty($value);
1322
                        } else {
1323
                            $TKT->set($field, $value);
1324
                        }
1325
                    }
1326
                    $update_prices = true;
1327
                }
1328
            }