Code Duplication    Length = 10-11 lines in 2 locations

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

@@ 908-917 (lines=10) @@
905
                // make sure we set PRC_is_default to false for all ticket saves from event_editor
906
                'PRC_order'      => $row,
907
            );
908
            if ($new_prices || empty($PRC_values['PRC_ID'])) {
909
                $PRC_values['PRC_ID'] = 0;
910
                $price = EE_Registry::instance()->load_class(
911
                    'Price',
912
                    array($PRC_values),
913
                    false,
914
                    false
915
                );
916
            } else {
917
                $price = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
918
                // update this price with new values
919
                foreach ($PRC_values as $field => $value) {
920
                    $price->set($field, $value);

admin_pages/events/Events_Admin_Page.core.php 1 location

@@ 1390-1400 (lines=11) @@
1387
                'PRC_is_default' => 0, // make sure prices are NOT set as default from this context
1388
                'PRC_order'      => $row,
1389
            );
1390
            if ($new_prices || empty($PRC_values['PRC_ID'])) {
1391
                $PRC_values['PRC_ID'] = 0;
1392
                $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), false, false);
1393
            } else {
1394
                $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1395
                // update this price with new values
1396
                foreach ($PRC_values as $field => $newprc) {
1397
                    $PRC->set($field, $newprc);
1398
                }
1399
                $PRC->save();
1400
            }
1401
            $ticket->_add_relation_to($PRC, 'Price');
1402
        }
1403
    }