/** * Get posted data and save it into the object (not db) * @return boolean */ function get_post($override_availability = false) { $this->tickets_bookings = new EM_Tickets_Bookings($this->booking_id); do_action('em_booking_get_post_pre', $this); $result = array(); $this->event_id = $_REQUEST['event_id']; if (isset($_REQUEST['em_tickets']) && is_array($_REQUEST['em_tickets']) && ($_REQUEST['em_tickets'] || $override_availability)) { foreach ($_REQUEST['em_tickets'] as $ticket_id => $values) { //make sure ticket exists if (!empty($values['spaces']) || $override_availability) { $args = array('ticket_id' => $ticket_id, 'ticket_booking_spaces' => $values['spaces'], 'booking_id' => $this->booking_id); if ($this->get_event()->get_bookings()->ticket_exists($ticket_id)) { $EM_Ticket_Booking = new EM_Ticket_Booking($args); $EM_Ticket_Booking->booking = $this; if (!$this->tickets_bookings->add($EM_Ticket_Booking, $override_availability)) { $this->add_error($this->tickets_bookings->get_errors()); } } else { $this->errors[] = __('You are trying to book a non-existent ticket for this event.', 'dbem'); } } } $this->booking_comment = !empty($_REQUEST['booking_comment']) ? wp_kses_data(stripslashes($_REQUEST['booking_comment'])) : ''; $this->get_spaces(true); $this->get_price(true, false, false); $this->get_person(); $this->compat_keys(); } return apply_filters('em_booking_get_post', count($this->errors) == 0, $this); }
/** * Get posted data and save it into the object (not db) * @return boolean */ function get_post($override_availability = false) { $this->tickets_bookings = new EM_Tickets_Bookings($this->booking_id); do_action('em_booking_get_post_pre', $this); $result = array(); $this->event_id = $_REQUEST['event_id']; if (isset($_REQUEST['em_tickets']) && is_array($_REQUEST['em_tickets']) && ($_REQUEST['em_tickets'] || $override_availability)) { foreach ($_REQUEST['em_tickets'] as $ticket_id => $values) { //make sure ticket exists if (!empty($values['spaces']) || $override_availability) { $args = array('ticket_id' => $ticket_id, 'ticket_booking_spaces' => $values['spaces'], 'booking_id' => $this->booking_id); if ($this->get_event()->get_bookings()->ticket_exists($ticket_id)) { $EM_Ticket_Booking = new EM_Ticket_Booking($args); $EM_Ticket_Booking->booking = $this; if (!$this->tickets_bookings->add($EM_Ticket_Booking, $override_availability)) { $this->add_error($this->tickets_bookings->get_errors()); } } else { $this->errors[] = __('You are trying to book a non-existent ticket for this event.', 'dbem'); } } } $this->booking_comment = !empty($_REQUEST['booking_comment']) ? wp_kses_data(stripslashes($_REQUEST['booking_comment'])) : ''; //allow editing of tax rate if (!empty($this->booking_id) && $this->can_manage()) { $this->booking_tax_rate = !empty($_REQUEST['booking_tax_rate']) && is_numeric($_REQUEST['booking_tax_rate']) ? $_REQUEST['booking_tax_rate'] : $this->booking_tax_rate; } //recalculate spaces/price $this->get_spaces(true); $this->calculate_price(); //get person $this->get_person(); //re-run compatiblity keys function $this->compat_keys(); //depricating in 6.0 } return apply_filters('em_booking_get_post', count($this->errors) == 0, $this); }