/** * Set Registration Code * * @access public * @param string $REG_code Registration Code * @param boolean $use_default */ public function set_reg_code($REG_code, $use_default = FALSE) { if (empty($REG_code)) { EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); return; } if (!$this->reg_code()) { parent::set('REG_code', $REG_code, $use_default); } else { EE_Error::doing_it_wrong(__CLASS__ . '::' . __FUNCTION__, __('Can not change a registration REG_code once it has been set.', 'event_espresso'), '4.6.0'); } }
/** * Set Status ID * updates the registration status and ALSO... * calls reserve_registration_space() if the reg status changes TO approved from any other reg status * calls release_registration_space() if the reg status changes FROM approved to any other reg status * * @access public * @param string $new_STS_ID */ public function set_status($new_STS_ID = '') { // get current REG_Status $old_STS_ID = $this->status_ID(); // if status has changed TO approved if ($old_STS_ID != $new_STS_ID && $new_STS_ID == EEM_Registration::status_id_approved) { // reserve a space by incrementing ticket and datetime sold values $this->_reserve_registration_space(); do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID); // OR if status has changed FROM approved } else { if ($old_STS_ID != $new_STS_ID && $old_STS_ID == EEM_Registration::status_id_approved) { // release a space by decrementing ticket and datetime sold values $this->_release_registration_space(); do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID); } } // update status parent::set('STS_ID', $new_STS_ID); do_action('AHEE__EE_Registration__set_status__after_update', $this, $old_STS_ID, $new_STS_ID); }