fixes for booking_late_price not existing when node is first created
This commit is contained in:
@@ -190,6 +190,7 @@ function _booking_change_status($nid, $status_id)
|
||||
|
||||
function _datearray_to_ts($date)
|
||||
{
|
||||
watchdog('booking', 'Date Conversion: @info', array('@info' => var_export($date, TRUE)));
|
||||
date_default_timezone_set(date_default_timezone(FALSE));
|
||||
$tz = new DateTimeZone(date_default_timezone(FALSE));
|
||||
|
||||
@@ -208,7 +209,7 @@ function _datearray_to_ts($date)
|
||||
|
||||
function _datetime_array_to_ts($date)
|
||||
{
|
||||
//watchdog('booking', 'Date-time Conversion: @info', array('@info' => var_export($date, TRUE)));
|
||||
watchdog('booking', 'Date-time Conversion: @info', array('@info' => var_export($date, TRUE)));
|
||||
//watchdog('booking', "Date time conversion timezone configured as: @info", array('@info' => date_default_timezone(FALSE)));
|
||||
date_default_timezone_set(date_default_timezone(FALSE));
|
||||
$tz = new DateTimeZone(date_default_timezone(FALSE));
|
||||
@@ -993,6 +994,7 @@ function _booking_amount_paid($nid, $person = NULL)
|
||||
*/
|
||||
function _booking_total_due($person)
|
||||
{
|
||||
//watchdog('booking', "<pre>_booking_total_due person:\n @info</pre>", array('@info' => print_r( $person, true)));
|
||||
$total_due = 0.00;
|
||||
|
||||
//check for a spouse
|
||||
@@ -1018,8 +1020,20 @@ function _booking_total_due($person)
|
||||
//finally we must be in the late-fee period
|
||||
else
|
||||
{
|
||||
$total_due = $person->booking_late_price;
|
||||
}
|
||||
//when first creating this node the price information won't all exist
|
||||
//since we combine that with the booking_person table in the hook for node_load
|
||||
if (!isset($person->booking_late_price)) {
|
||||
//query the database based on the payment_id that is set when we first create the node
|
||||
$query = db_select('booking_price', 'p');
|
||||
$query->condition('p.pid', $person->booking_payment_id, '=')
|
||||
->fields('p');
|
||||
$result = $query->execute()->fetchObject();
|
||||
//set the result
|
||||
$total_due = $result->booking_late_price;
|
||||
} else {
|
||||
$total_due = $person->booking_late_price;
|
||||
}
|
||||
} //end payment type conditional
|
||||
|
||||
return $total_due;
|
||||
}
|
||||
|
Reference in New Issue
Block a user