Code Duplication    Length = 10-11 lines in 2 locations

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;

admin_pages/events/Events_Admin_Page.core.php 1 location

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