Code Duplication    Length = 4-5 lines in 4 locations

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

@@ 258-262 (lines=5) @@
255
			$evt_obj->save();
256
257
			//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.
258
			if( $DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end') ) {
259
				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start') );
260
				$DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days');
261
				$DTM->save();
262
			}
263
264
			//	now we have to make sure we add the new DTT_ID to the $saved_dtt_ids array
265
			// because it is possible there was a new one created for the autosave.
@@ 459-462 (lines=4) @@
456
			//$TKT->save();
457
458
			//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.
459
			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
460
				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
461
				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
462
			}
463
464
			//let's make sure the base price is handled
465
			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT;

admin_pages/events/Events_Admin_Page.core.php 2 locations

@@ 995-999 (lines=5) @@
992
			//load DTT helper
993
994
			//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.
995
			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
996
				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
997
				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
998
				$DTT->save();
999
			}
1000
1001
			//now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
1002
			$saved_dtt = $DTT;
@@ 1125-1129 (lines=5) @@
1122
			$TKT->save();
1123
1124
			//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.
1125
			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
1126
				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
1127
				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1128
				$TKT->save();
1129
			}
1130
1131
			//initially let's add the ticket to the dtt
1132
			$saved_dtt->_add_relation_to( $TKT, 'Ticket' );