Bugfixes relating to early bird rate closing
This commit is contained in:
@@ -552,7 +552,7 @@ function _booking_amount_paid($nid, $person = NULL)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//calculate the amount outstanding for a person/married couple
|
//calculate the amount outstanding for a person/married couple
|
||||||
function _booking_amount_owing($nid, $amount_paid = 0)
|
function _booking_amount_owing($nid, $amount_paid = 0, $include_paypal_fees = TRUE)
|
||||||
{
|
{
|
||||||
//$amount_paid = 0;
|
//$amount_paid = 0;
|
||||||
$total_due = 0;
|
$total_due = 0;
|
||||||
@@ -579,23 +579,21 @@ function _booking_amount_owing($nid, $amount_paid = 0)
|
|||||||
//finally we must be in the late-fee period
|
//finally we must be in the late-fee period
|
||||||
else
|
else
|
||||||
$total_due = $person->booking_late_price;
|
$total_due = $person->booking_late_price;
|
||||||
|
|
||||||
//watchdog('booking', "Total amount due for this registration " . $nid . " is " . $total_due);
|
|
||||||
|
|
||||||
//if we didn't get the amount paid as a command line parameter, check it now
|
//if we didn't get the amount paid as a command line parameter, check it now
|
||||||
if ($amount_paid == 0)
|
if ($amount_paid == 0)
|
||||||
{
|
{
|
||||||
$amount_paid = _booking_amount_paid($nid, $person);
|
$amount_paid = _booking_amount_paid($nid, $person);
|
||||||
}
|
}
|
||||||
//check if there is anything outstanding
|
//check if there is anything outstanding
|
||||||
if ($amount_paid >= $total_due)
|
if ($amount_paid >= $person->booking_total_pay_reqd)
|
||||||
{
|
{
|
||||||
//watchdog('booking', "This person doesn't owe any money: @info", array('@info' => var_export($person, TRUE)));
|
//watchdog('booking', "This person doesn't owe any money: @info", array('@info' => var_export($person, TRUE)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if we're using paypal, add the transaction fee
|
//if we're using paypal, add the transaction fee
|
||||||
if (variable_get('booking_use_paypal', 0) == 1)
|
if (variable_get('booking_use_paypal', 0) == 1 && $include_paypal_fees == TRUE)
|
||||||
{
|
{
|
||||||
//add the 30 cent fixed cost
|
//add the 30 cent fixed cost
|
||||||
$amount_owing = $total_due - $amount_paid + 0.3;
|
$amount_owing = $total_due - $amount_paid + 0.3;
|
||||||
|
@@ -84,7 +84,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$select_early = 0;
|
$select_early = 0;
|
||||||
watchdog('booking', 'No longer accepting earlybird prices');
|
//watchdog('booking', 'No longer accepting earlybird prices');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = db_query("SELECT pid, booking_price_descrip, booking_price, booking_late_price FROM {booking_price} where booking_eventid = :eid " .
|
$result = db_query("SELECT pid, booking_price_descrip, booking_price, booking_late_price FROM {booking_price} where booking_eventid = :eid " .
|
||||||
@@ -1054,7 +1054,7 @@ function booking_load($nodes) {
|
|||||||
$query->condition('p.nid', array_keys($nodes), 'IN')
|
$query->condition('p.nid', array_keys($nodes), 'IN')
|
||||||
->fields('p')
|
->fields('p')
|
||||||
->fields('t')
|
->fields('t')
|
||||||
->fields('pr', array('booking_price', 'booking_price_descrip'));
|
->fields('pr', array('booking_price', 'booking_price_descrip','booking_late_price'));
|
||||||
|
|
||||||
//now add the study group fields
|
//now add the study group fields
|
||||||
for ($i = 1; $i <= 7; $i++)
|
for ($i = 1; $i <= 7; $i++)
|
||||||
@@ -1072,7 +1072,7 @@ function booking_load($nodes) {
|
|||||||
$query->condition('p.nid', array_keys($nodes), 'IN')
|
$query->condition('p.nid', array_keys($nodes), 'IN')
|
||||||
->fields('p')
|
->fields('p')
|
||||||
->fields('t')
|
->fields('t')
|
||||||
->fields('pr', array('booking_price', 'booking_price_descrip'));
|
->fields('pr', array('booking_price', 'booking_price_descrip','booking_late_price'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -92,6 +92,9 @@ function booking_report_summary() {
|
|||||||
$result = $table_sort->execute();
|
$result = $table_sort->execute();
|
||||||
|
|
||||||
foreach ($result as $person) {
|
foreach ($result as $person) {
|
||||||
|
|
||||||
|
$amount_owing = _booking_amount_owing($person->nid);
|
||||||
|
|
||||||
$rows[] = array(
|
$rows[] = array(
|
||||||
l(t('!id', array('!id' => $person->nid)), t('node/!id', array('!id' => $person->nid))),
|
l(t('!id', array('!id' => $person->nid)), t('node/!id', array('!id' => $person->nid))),
|
||||||
//l(t('!id', array('!id' => $person->nid)), t('node/!id/edit', array('!id' => $person->nid))),
|
//l(t('!id', array('!id' => $person->nid)), t('node/!id/edit', array('!id' => $person->nid))),
|
||||||
@@ -100,8 +103,8 @@ function booking_report_summary() {
|
|||||||
),
|
),
|
||||||
t('!email', array('!email' => $person->booking_email)),
|
t('!email', array('!email' => $person->booking_email)),
|
||||||
t('!payment', array('!payment' => $person->booking_amount_paid)),
|
t('!payment', array('!payment' => $person->booking_amount_paid)),
|
||||||
t('!payment', array('!payment' => $person->booking_total_pay_reqd)),
|
t('!payment', array('!payment' => $person->booking_total_pay_reqd)),
|
||||||
_booking_amount_paid($person->nid, $person) >= $person->booking_total_pay_reqd ? 'Yes' : 'No',
|
t('!fullypaid', array('!fullypaid' => $amount_owing == 0 ? 'Yes' : 'No')),
|
||||||
t($person->booking_welfare_required == 'Y' ? 'Yes' : 'No'),
|
t($person->booking_welfare_required == 'Y' ? 'Yes' : 'No'),
|
||||||
);
|
);
|
||||||
$total_paid += $person->booking_amount_paid;
|
$total_paid += $person->booking_amount_paid;
|
||||||
@@ -120,18 +123,10 @@ function booking_report_summary() {
|
|||||||
if ($person->booking_welfare_required == 'Y')
|
if ($person->booking_welfare_required == 'Y')
|
||||||
$welfare_count++;
|
$welfare_count++;
|
||||||
|
|
||||||
//fully paid?
|
//fully paid?
|
||||||
if ($person->booking_amount_paid >= $person->booking_total_pay_reqd || $person->booking_total_pay_reqd == "0.00")
|
if ($amount_owing == 0)
|
||||||
{
|
|
||||||
//watchdog('booking', "Fully paid person, ID !id (!first !last)", array('!id' => $person->nid,'!first' => ucwords($person->booking_firstname), '!last' => ucwords($person->booking_lastname)));
|
|
||||||
$fullypaid_count++;
|
$fullypaid_count++;
|
||||||
}
|
|
||||||
elseif ($person->booking_partner_id > 0 && _booking_amount_owing($person->nid) == 0)
|
|
||||||
{
|
|
||||||
//watchdog('booking', "Fully paid married person, ID !id (!first !last)", array('!id' => $person->nid,'!first' => ucwords($person->booking_firstname), '!last' => ucwords($person->booking_lastname)));
|
|
||||||
$fullypaid_count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//general stats
|
//general stats
|
||||||
$dob_total += $person->booking_dob;
|
$dob_total += $person->booking_dob;
|
||||||
$person_count++;
|
$person_count++;
|
||||||
|
@@ -620,7 +620,8 @@ function booking_define_personspecific_tokens($node)
|
|||||||
$tokens['lname'] = ucwords(trim($node->booking_lastname));
|
$tokens['lname'] = ucwords(trim($node->booking_lastname));
|
||||||
$tokens['dietary'] = ucwords(trim($node->booking_dietary));
|
$tokens['dietary'] = ucwords(trim($node->booking_dietary));
|
||||||
$tokens['booking-id'] = $node->nid;
|
$tokens['booking-id'] = $node->nid;
|
||||||
$tokens['payment-required'] = $node->booking_total_pay_reqd - $amount_paid;
|
//$tokens['payment-required'] = $node->booking_total_pay_reqd - $amount_paid;
|
||||||
|
$tokens['payment-required'] = _booking_amount_owing($node->nid, $amount_paid, FALSE);
|
||||||
$tokens['waitinglist-position'] = $result->num_ppl - variable_get('booking_regn_limit',350) + 1;
|
$tokens['waitinglist-position'] = $result->num_ppl - variable_get('booking_regn_limit',350) + 1;
|
||||||
$tokens['payment-transaction-desc'] = $node->nid . ' ' . $node->booking_lastname;
|
$tokens['payment-transaction-desc'] = $node->nid . ' ' . $node->booking_lastname;
|
||||||
$tokens['balance-payment-link'] = url('balance/' . $tempid, array('absolute' => TRUE));
|
$tokens['balance-payment-link'] = url('balance/' . $tempid, array('absolute' => TRUE));
|
||||||
|
Reference in New Issue
Block a user