@@ 93-113 (lines=21) @@ | ||
90 | // get current Event status |
|
91 | $old_status = $this->status(); |
|
92 | // if status has changed |
|
93 | if ( $old_status != $new_status ) { |
|
94 | // TO sold_out |
|
95 | if ( $new_status == EEM_Event::sold_out ) { |
|
96 | // save the previous event status so that we can revert if the event is no longer sold out |
|
97 | $this->add_post_meta( '_previous_event_status', $old_status ); |
|
98 | do_action( 'AHEE__EE_Event__set_status__to_sold_out', $this, $old_status, $new_status ); |
|
99 | // OR FROM sold_out |
|
100 | } else if ( $old_status == EEM_Event::sold_out ) { |
|
101 | $this->delete_post_meta( '_previous_event_status' ); |
|
102 | do_action( 'AHEE__EE_Event__set_status__from_sold_out', $this, $old_status, $new_status ); |
|
103 | } |
|
104 | // update status |
|
105 | parent::set( 'status', $new_status, $use_default ); |
|
106 | do_action( 'AHEE__EE_Event__set_status__after_update', $this ); |
|
107 | return true; |
|
108 | } else { |
|
109 | // even though the old value matches the new value, it's still good to |
|
110 | // allow the parent set method to have a say |
|
111 | parent::set( 'status', $new_status, $use_default ); |
|
112 | return true; |
|
113 | } |
|
114 | } |
|
115 | ||
116 |
@@ 113-134 (lines=22) @@ | ||
110 | // get current REG_Status |
|
111 | $old_STS_ID = $this->status_ID(); |
|
112 | // if status has changed |
|
113 | if ( $old_STS_ID != $new_STS_ID ) { |
|
114 | // TO approved |
|
115 | if ( $new_STS_ID == EEM_Registration::status_id_approved ) { |
|
116 | // reserve a space by incrementing ticket and datetime sold values |
|
117 | $this->_reserve_registration_space(); |
|
118 | do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
119 | // OR FROM approved |
|
120 | } else if ( $old_STS_ID == EEM_Registration::status_id_approved ) { |
|
121 | // release a space by decrementing ticket and datetime sold values |
|
122 | $this->_release_registration_space(); |
|
123 | do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
124 | } |
|
125 | // update status |
|
126 | parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
127 | do_action( 'AHEE__EE_Registration__set_status__after_update', $this ); |
|
128 | return TRUE; |
|
129 | }else{ |
|
130 | //even though the old value matches the new value, it's still good to |
|
131 | //allow the parent set method to have a say |
|
132 | parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
133 | return TRUE; |
|
134 | } |
|
135 | } |
|
136 | ||
137 |