/**
  * 		generates HTML for the Edit Registration side meta box
  *		@access public
  *		@return void
  */
 public function _reg_registrant_side_meta_box()
 {
     /*@var $attendee EE_Attendee */
     $att_check = $this->_registration->attendee();
     $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object();
     //now let's determine if this is not the primary registration.  If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show cereate button or not)
     if (!$this->_registration->is_primary_registrant()) {
         $primary_registration = $this->_registration->get_primary_registration();
         $primary_attendee = $primary_registration->attendee();
         if (!$primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
             //in here?  This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg.
             $primary_registration = NULL;
         }
     } else {
         $primary_registration = NULL;
     }
     $this->_template_args['ATT_ID'] = $attendee->ID();
     $this->_template_args['fname'] = $attendee->fname();
     //$this->_registration->ATT_fname;
     $this->_template_args['lname'] = $attendee->lname();
     //$this->_registration->ATT_lname;
     $this->_template_args['email'] = $attendee->email();
     //$this->_registration->ATT_email;
     $this->_template_args['phone'] = $attendee->phone();
     $this->_template_args['formatted_address'] = EEH_Address::format($attendee);
     //edit link
     $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit_attendee', 'post' => $attendee->ID()), REG_ADMIN_URL);
     $this->_template_args['att_edit_label'] = __('View/Edit Contact');
     //create link
     $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : '';
     $this->_template_args['create_label'] = __('Create Contact', 'event_espresso');
     $this->_template_args['att_check'] = $att_check;
     $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
     echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
 }
 /**
  * This is a helper method used to very whether a registration notification should be sent or
  * not.  Prevents duplicate notifications going out for registration context notifications.
  *
  * @param EE_Registration $registration  [description]
  * @param array           $extra_details [description]
  *
  * @return bool          true = send away, false = nope halt the presses.
  */
 protected static function _verify_registration_notification_send(EE_Registration $registration, $extra_details = array())
 {
     //self::log(
     //	__CLASS__, __FUNCTION__, __LINE__,
     //	$registration->transaction(),
     //	array( '$extra_details' => $extra_details )
     //);
     // currently only using this to send messages for the primary registrant
     if (!$registration->is_primary_registrant()) {
         return false;
     }
     if (!apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false) && $registration->status_ID() !== EEM_Registration::status_id_not_approved) {
         return false;
     }
     // release the kraken
     return true;
 }
 /**
  * _save_registration_attendee
  *
  * @param 	EE_Registration 	$registration
  * @return void
  */
 protected function _refresh_registration_attendee($registration)
 {
     $attendee = $registration->attendee();
     // verify object
     if ($attendee instanceof EE_Attendee && $attendee->ID()) {
         // make sure the cached attendee is added to the model entity mapper
         $registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee);
         // maybe cache primary_attendee_obj ?
         if ($registration->is_primary_registrant()) {
             $this->primary_attendee_obj = $attendee;
         }
     }
 }
 /**
  * This is a helper method used to very whether a registration notification should be sent or
  * not.  Prevents duplicate notifications going out for registration context notifications.
  *
  * @param EE_Registration $registration  [description]
  * @param array           $extra_details [description]
  *
  * @return bool          true = send away, false = nope halt the presses.
  */
 protected static function _verify_registration_notification_send(EE_Registration $registration, $extra_details = array())
 {
     //self::log(
     //	__CLASS__, __FUNCTION__, __LINE__,
     //	$registration->transaction(),
     //	array( '$extra_details' => $extra_details )
     //);
     // currently only using this to send messages for the primary registrant
     if (!$registration->is_primary_registrant()) {
         return false;
     }
     // first we check if we're in admin and not doing front ajax
     if (is_admin() && !EE_FRONT_AJAX) {
         //make sure appropriate admin params are set for sending messages
         if (empty($_REQUEST['txn_reg_status_change']['send_notifications']) || !absint($_REQUEST['txn_reg_status_change']['send_notifications'])) {
             //no messages sent please.
             return false;
         }
     } else {
         // frontend request (either regular or via AJAX)
         // TXN is NOT finalized ?
         if (!isset($extra_details['finalized']) || $extra_details['finalized'] === false) {
             return false;
         }
         // return visit but nothing changed ???
         if (isset($extra_details['revisit'], $extra_details['status_updates']) && $extra_details['revisit'] && !$extra_details['status_updates']) {
             return false;
         }
         // NOT sending messages && reg status is something other than "Not-Approved"
         if (!apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false) && $registration->status_ID() !== EEM_Registration::status_id_not_approved) {
             return false;
         }
     }
     // release the kraken
     return true;
 }