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

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