Update _booking_amount_owing to use $person object instead of just a node id
This commit is contained in:
@@ -643,13 +643,13 @@ function _booking_total_due($person)
|
||||
* @param $include_paypal_fees - boolean to indicate whether we want the net amount or the amount owing including paypal fees
|
||||
* @return amount owing as a decimal value
|
||||
*/
|
||||
function _booking_amount_owing($nid, $amount_paid = 0, $include_paypal_fees = TRUE)
|
||||
function _booking_amount_owing($person, $amount_paid = 0, $include_paypal_fees = TRUE)
|
||||
{
|
||||
//$amount_paid = 0;
|
||||
//$total_due = 0;
|
||||
|
||||
//fetch details about the person
|
||||
|
||||
/*
|
||||
$person = db_query("SELECT price.booking_price, price.booking_late_price, person.booking_payment_id, " .
|
||||
"person.booking_total_pay_reqd, person.booking_amount_paid, person.booking_partner_id, person.booking_country, person.booking_welfare_required, person.booking_committee_member " .
|
||||
"FROM {booking_person} person, {booking_price} price " .
|
||||
@@ -659,10 +659,10 @@ function _booking_amount_owing($nid, $amount_paid = 0, $include_paypal_fees = TR
|
||||
->fetchObject();
|
||||
|
||||
//$person = node_load($nid);
|
||||
|
||||
*/
|
||||
//quick sanity check
|
||||
if (! $person) {
|
||||
watchdog('booking', "Unable to find matching person relating to registration id '" . $nid . "' .");
|
||||
if (! $person->nid) {
|
||||
watchdog('booking', "Unable to find matching person relating to registration id. Details were '" . var_export($person, TRUE) . "' .");
|
||||
return 0.00;
|
||||
}
|
||||
|
||||
@@ -671,7 +671,7 @@ function _booking_amount_owing($nid, $amount_paid = 0, $include_paypal_fees = TR
|
||||
//if we didn't get the amount paid as a command line parameter, check it now
|
||||
if ($amount_paid == 0)
|
||||
{
|
||||
$amount_paid = _booking_amount_paid($nid, $person);
|
||||
$amount_paid = _booking_amount_paid($person->nid, $person);
|
||||
}
|
||||
|
||||
//check if there is anything outstanding
|
||||
|
Reference in New Issue
Block a user