Code Duplication    Length = 10-11 lines in 2 locations

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

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

admin_pages/events/Events_Admin_Page.core.php 1 location

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