Normalize handling of pickup_bool in booking data.
Refactored `pickup_bool` parsing to ensure consistent boolean handling across the application. Replaced mixed type checks with explicit boolean conversion and updated relevant logic to improve data reliability. This change avoids potential errors caused by inconsistent input formats.
This commit is contained in:
@@ -88,6 +88,15 @@ class wordpress_bookings_remote implements wordpress_bookings_remote_i
|
||||
return null;
|
||||
}
|
||||
|
||||
// Parse the booking pickup bool
|
||||
// 1 = true, 0 = false
|
||||
// "true" = true, "false" = false
|
||||
if ($booking["pickup_bool"] === 1 || $booking["pickup_bool"] === "true") {
|
||||
$booking["pickup_bool"] = true;
|
||||
} else {
|
||||
$booking["pickup_bool"] = false;
|
||||
}
|
||||
|
||||
$this->booking_cache[$booking["id"]] = [
|
||||
"id" => (int)$booking["id"],
|
||||
"customer_number" => (int)$booking["customer_number"],
|
||||
@@ -99,7 +108,7 @@ class wordpress_bookings_remote implements wordpress_bookings_remote_i
|
||||
"washCertificateEmail" => (string)$booking["washCertificateEmail"],
|
||||
"date" => (string)$booking["date"],
|
||||
"department" => (string)$booking["department"],
|
||||
"pickup_bool" => (boolean)$booking["pickup_bool"] ? 'true' : 'false',
|
||||
"pickup_bool" => $booking["pickup_bool"],
|
||||
"notes" => (string)$booking["notes"],
|
||||
"washCertificateStatus" => (string)$booking["washCertificateStatus"],
|
||||
"washCertificateUrl" => (string)$booking["washCertificateUrl"],
|
||||
|
||||
@@ -143,7 +143,7 @@ class bookings_o extends db
|
||||
$booking['washCertificateEmail'],
|
||||
$booking['date'],
|
||||
$booking['department'],
|
||||
$booking['pickup_bool'] === 'true' ? 1 : 0,
|
||||
$booking['pickup_bool'] ? 1 : 0,
|
||||
$booking['notes'],
|
||||
$booking['washCertificateStatus'],
|
||||
$booking['washCertificateUrl'],
|
||||
|
||||
Reference in New Issue
Block a user