allow discounted rate for early access registrations

This commit is contained in:
2017-08-29 22:36:08 +10:00
parent 57bf81dfa4
commit d568cf2043
2 changed files with 19 additions and 3 deletions

View File

@@ -801,6 +801,22 @@ function _booking_is_earlybird() {
}
}
//figure out if we're in the right time period for discounted registration rates
function _booking_is_earlyaccess() {
global $event;
if (variable_get('booking_enable_earlyaccess_codes', 0) == 1) {
$booking_times = db_query("SELECT booking_register_open, booking_register_close FROM {booking_event} where eid = :eid",
array(':eid' => $event->eid))->fetchObject();
//if we're now before the time that registrations open, then this registration must be from the early access time period
return ($booking_times->booking_register_open > time());
}
//if the feature isn't enabled then just return false
return FALSE;
}
function _booking_datepaid_ts($nid) {
$query = db_query("SELECT * FROM {booking_payment} where booking_person_nid = :nid", array(':nid' => $nid))
->fetchObject();
@@ -966,7 +982,7 @@ function _booking_total_due($person)
$total_due = $person->booking_total_pay_reqd;
}
//the early bird rate will be defined by default for the registration
elseif (_booking_is_earlybird() == TRUE)
elseif (_booking_is_earlybird() == TRUE || _booking_is_earlyaccess() == TRUE)
{
$total_due = $person->booking_total_pay_reqd;
}

View File

@@ -199,8 +199,8 @@ function booking_form($node, &$form_state, $inserting = FALSE, $early_access_all
$form['your-details']['booking_dob']['#date_year_range'] = $date_year_range;
}
$early_description_text = t("Please note that this is the discounted payment rate. Fore more information about payment rates, please see !theweek",
array('!theweek' => l('The Week page', 'the-week/whats-happening')));
$early_description_text = t("Please note that this is the discounted payment rate. For more information about payment rates, please see !theweek page.",
array('!theweek' => l('The Week', 'the-week/whats-happening')));
$form['your-details']['booking_payment_id'] = array(
'#type' => 'select',
'#title' => t('Choose your payment type'),