-
Notifications
You must be signed in to change notification settings - Fork 44
Booking search returns a "DB error: syntax error" (CiviCRM 5.19.2) #183
Comments
Have updated the system to 5.20 and the only thing broken now is the date range. Error message below: Array
( .start_date >= '20191202000000' ) AND |
I'm not able to retrace what has caused this problem in core but it seems that core is now adding the where clause before getting to CRM_Booking_BAO_Query::where Core function CRM_Contact_BAO_Query::restWhere expect the table_name to be defined in the DAO fields definition. We should probably rebuild the DAOs to fix this properly but for now, the following patch fix the bug for me: diff --git a/CRM/Booking/DAO/Booking.php b/CRM/Booking/DAO/Booking.php
index 28aa140..3266313 100644
--- a/CRM/Booking/DAO/Booking.php
+++ b/CRM/Booking/DAO/Booking.php
@@ -299,6 +303,7 @@ class CRM_Booking_DAO_Booking extends CRM_Core_DAO
'where' => 'civicrm_booking.booking_date',
'headerPattern' => '',
'dataPattern' => '',
+ 'table_name' => 'civicrm_booking',
) ,
'booking_start_date' => array(
'name' => 'start_date',
@@ -309,6 +314,7 @@ class CRM_Booking_DAO_Booking extends CRM_Core_DAO
'where' => 'civicrm_booking.start_date',
'headerPattern' => '',
'dataPattern' => '',
+ 'table_name' => 'civicrm_booking',
) ,
'booking_end_date' => array(
'name' => 'end_date',
@@ -319,6 +325,7 @@ class CRM_Booking_DAO_Booking extends CRM_Core_DAO
'where' => 'civicrm_booking.end_date',
'headerPattern' => '',
'dataPattern' => '',
+ 'table_name' => 'civicrm_booking',
) ,
'booking_po_number' => array(
'name' => 'po_number', That means we could also probably remove some legacy code in CRM_Booking_BAO_Query and maybe elsewhere. |
Hi,
I've just upgraded a site from 5.13.4 to 5.19.2 with this extension previously working on it. When I perform a booking search now with a start date range, it throws an error "DB error: syntax error"
The report log states "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax".
Can someone look into the cause of this please?
Thank you.
The text was updated successfully, but these errors were encountered: