Code Duplication    Length = 5-6 lines in 3 locations

admin_pages/events/Events_Admin_Page.core.php 1 location

@@ 1118-1123 (lines=6) @@
1115
			$TKT->save();
1116
1117
			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
1118
			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
1119
				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
1120
				EE_Registry::instance()->load_helper('DTT_Helper');
1121
				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1122
				$TKT->save();
1123
			}
1124
1125
			//initially let's add the ticket to the dtt
1126
			$saved_dtt->_add_relation_to( $TKT, 'Ticket' );

caffeinated/admin/new/pricing/espresso_events_Pricing_Hooks.class.php 2 locations

@@ 259-264 (lines=6) @@
256
			$evt_obj->save();
257
258
			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
259
			if( $DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end') ) {
260
				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start') );
261
				EE_Registry::instance()->load_helper('DTT_Helper');
262
				$DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days');
263
				$DTM->save();
264
			}
265
266
			//	now we have to make sure we add the new DTT_ID to the $saved_dtt_ids array
267
			// because it is possible there was a new one created for the autosave.
@@ 462-466 (lines=5) @@
459
			//$TKT->save();
460
461
			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
462
			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
463
				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
464
				EE_Registry::instance()->load_helper('DTT_Helper');
465
				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
466
			}
467
468
			//let's make sure the base price is handled
469
			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT;