From e489fa696ca87dddd39ac84ec3d333e67c40bc94 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 26 Nov 2017 10:51:28 +0100 Subject: [PATCH] * InfoLog: fix SQL error on update for to long from and addr also use our db abstraction for PostgreSQL correct concat --- infolog/setup/tables_update.inc.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/infolog/setup/tables_update.inc.php b/infolog/setup/tables_update.inc.php index 3a81111231..36f8860e5c 100644 --- a/infolog/setup/tables_update.inc.php +++ b/infolog/setup/tables_update.inc.php @@ -11,6 +11,8 @@ * @version $Id$ */ +use EGroupware\Api; + function infolog_upgrade0_9_11() { $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_infolog','info_datecreated','info_datemodified'); @@ -937,7 +939,13 @@ function infolog_upgrade16_1_002() */ function infolog_upgrade16_1_003() { - $GLOBALS['egw_setup']->db->query("UPDATE egw_infolog SET info_from = CASE WHEN info_from != '' THEN CONCAT(info_from, ', ', info_addr) ELSE info_addr END". + // copy full info_addr to info_des, if length(info_from)+length(info_addr)+2 > 255 and then shorten it to fit + $GLOBALS['egw_setup']->db->query("UPDATE egw_infolog SET info_des=". + $GLOBALS['egw_setup']->db->concat('info_addr', "\n\n", 'info_des'). + " WHERE LENGTH(info_from)+LENGTH(info_addr > 253", __LINE__, __FILE__); + + $GLOBALS['egw_setup']->db->query("UPDATE egw_infolog SET info_from = CASE WHEN info_from != '' THEN SUBSTRING(". + $GLOBALS['egw_setup']->db->concat('info_from', "', '", 'info_addr')." FROM 1 FOR 255) ELSE info_addr END". " WHERE info_addr != ''", __LINE__, __FILE__); $GLOBALS['egw_setup']->oProc->DropColumn('egw_infolog',array(