From 668ba6f6323c76046694e34ab0e0f1d257a9dfce Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 18 Jan 2019 10:47:46 +0100 Subject: [PATCH] PostgreSQL needs more casts / abstraction to fix SQL error contact_id/account_id are int, but cal_user_id is varchar --- api/src/Contacts.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/src/Contacts.php b/api/src/Contacts.php index f6ec58fb21..e5796c4edc 100755 --- a/api/src/Contacts.php +++ b/api/src/Contacts.php @@ -1698,6 +1698,7 @@ class Contacts extends Contacts\Storage $calendars = array(); $bocal = new calendar_bo(); $type_field = $type=='u' ? 'account_id' : 'contact_id'; + $type_field_varchar = $this->db->to_varchar($type_field); $concat_start_id_recurrance = $this->db->concat('cal_start',"':'",'egw_cal_user.cal_id',"':'",'cal_recur_date'); $now = $this->db->unix_timestamp('NOW()'); $sql = "SELECT n_fn,org_name,$type_field AS user_id, @@ -1706,7 +1707,7 @@ class Contacts extends Contacts\Storage FROM egw_cal_user JOIN egw_cal_dates on egw_cal_dates.cal_id=egw_cal_user.cal_id and (cal_recur_date=0 or cal_recur_date=cal_start) JOIN egw_cal ON egw_cal.cal_id=egw_cal_user.cal_id AND egw_cal.cal_deleted IS NULL - WHERE cal_user_type='$type' and cal_user_id=$type_field and cal_start < $now"; + WHERE cal_user_type='$type' and cal_user_id=$type_field_varchar and cal_start < $now"; if ( !$GLOBALS['egw_info']['user']['preferences']['calendar']['show_rejected']) { $sql .= " AND egw_cal_user.cal_status != 'R'"; @@ -1719,7 +1720,7 @@ class Contacts extends Contacts\Storage FROM egw_cal_user JOIN egw_cal_dates on egw_cal_dates.cal_id=egw_cal_user.cal_id and (cal_recur_date=0 or cal_recur_date=cal_start) JOIN egw_cal ON egw_cal.cal_id=egw_cal_user.cal_id AND egw_cal.cal_deleted IS NULL - WHERE cal_user_type='$type' and cal_user_id=$type_field and cal_start > $now"; + WHERE cal_user_type='$type' and cal_user_id=$type_field_varchar and cal_start > $now"; if ( !$GLOBALS['egw_info']['user']['preferences']['calendar']['show_rejected']) { $sql .= " AND egw_cal_user.cal_status != 'R'";