From 6c9217f97b14c344e446d4d5949b2794c26c7192 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Sat, 1 Mar 2014 00:43:26 +1100 Subject: [PATCH] Comments for amount owing function --- booking.helper.inc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/booking.helper.inc b/booking.helper.inc index 658f121..1298ff0 100644 --- a/booking.helper.inc +++ b/booking.helper.inc @@ -551,7 +551,14 @@ function _booking_amount_paid($nid, $person = NULL) return $amount_paid; } -//calculate the amount outstanding for a person/married couple +/** + * Function to calculate the amount outstanding for a person/married couple + * + * @param $nid - the node id relating to the registration node + * @param $amount_paid - if we have previously calculated the amount paid, this can be passed as a value + * @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) { //$amount_paid = 0; @@ -585,7 +592,9 @@ function _booking_amount_owing($nid, $amount_paid = 0, $include_paypal_fees = TR { $amount_paid = _booking_amount_paid($nid, $person); } + //check if there is anything outstanding + //use the original total amount required rather than the late-rate, to cater for people that paid before the late rate if ($amount_paid >= $person->booking_total_pay_reqd) { //watchdog('booking', "This person doesn't owe any money: @info", array('@info' => var_export($person, TRUE)));