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

@@ 1274-1280 (lines=7) @@
1271
                    $TKT->set_date_format($incoming_date_formats[0]);
1272
                    $TKT->set_time_format($incoming_date_formats[1]);
1273
                    // set new values
1274
                    foreach ($TKT_values as $field => $value) {
1275
                        if ($field == 'TKT_qty') {
1276
                            $TKT->set_qty($value);
1277
                        } else {
1278
                            $TKT->set($field, $value);
1279
                        }
1280
                    }
1281
                    // if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1282
                    if ($create_new_TKT) {
1283
                        // archive the old ticket first
@@ 1310-1316 (lines=7) @@
1307
                    $TKT->set_time_format($incoming_date_formats[1]);
1308
                    $TKT->set_timezone($evtobj->get_timezone());
1309
                    // set new values
1310
                    foreach ($TKT_values as $field => $value) {
1311
                        if ($field == 'TKT_qty') {
1312
                            $TKT->set_qty($value);
1313
                        } else {
1314
                            $TKT->set($field, $value);
1315
                        }
1316
                    }
1317
                    $update_prices = true;
1318
                }
1319
            }