Code Duplication    Length = 10-11 lines in 2 locations

admin_pages/events/Events_Admin_Page.core.php 1 location

@@ 1184-1194 (lines=11) @@
1181
				'PRC_order' => $row
1182
			);
1183
1184
			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
1185
				$PRC_values['PRC_ID'] = 0;
1186
				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
1187
			} else {
1188
				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
1189
				//update this price with new values
1190
				foreach ( $PRC_values as $field => $newprc ) {
1191
					$PRC->set( $field, $newprc );
1192
				}
1193
				$PRC->save();
1194
			}
1195
1196
			$ticket->_add_relation_to( $PRC, 'Price' );
1197
		}

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

@@ 730-739 (lines=10) @@
727
				'PRC_is_default' => false, //make sure we set PRC_is_default to false for all ticket saves from event_editor
728
				'PRC_order' => $row
729
				);
730
			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
731
				$PRC_values['PRC_ID'] = 0;
732
				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
733
			} else {
734
				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
735
				//update this price with new values
736
				foreach ( $PRC_values as $field => $newprc ) {
737
					$PRC->set( $field, $newprc );
738
				}
739
			}
740
			$PRC->save();
741
			$prcid = $PRC->ID();
742
			$updated_prices[$prcid] = $PRC;