/**
  *
  * @param array  $props_n_values
  * @param string $timezone
  * @return EE_Datetime
  */
 public static function new_instance($props_n_values = array(), $timezone = NULL)
 {
     $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone);
     return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone);
 }
 /**
  *        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');
     }
 }
 /**
  * @param array $props_n_values
  * @return EE_Price_Type
  */
 public static function new_instance($props_n_values = array())
 {
     $has_object = parent::_check_for_object($props_n_values, __CLASS__);
     return $has_object ? $has_object : new self($props_n_values);
 }
 /**
  *
  * @param array $props_n_values  incoming values
  * @param string $timezone  incoming timezone (if not set the timezone set for the website will be
  *                          		used.)
  * @param array $date_formats  incoming date_formats in an array where the first value is the
  *                             		    date_format and the second value is the time format
  * @return EE_Attendee
  */
 public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array())
 {
     $has_object = parent::_check_for_object($props_n_values, __CLASS__);
     return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
 }
 /**
  *    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);
 }