We have a Service Ticket entity which has a field "ageing" where the system automatically calculates how many weeks has the Service Ticket been open.
Prior to Espo 7.4 the Service Ticket entityDefs json file looked like this:
This feature worked fine, but when we upgraded to 7.4, we immediately got this ERROR 500 message originated from the new DefaultSqlExecutor class:
And after some hours of searching through the code base and testing, we were able to figure out that the new way to invoke this functionality was as follows:
To see a list of all "SQL" functions available in the ORM check this script: https://github.com/espocrm/espocrm/b...ctions.php#L30
To see how these functions are implemented for MySql, Maria and similar databases, see this script: https://github.com/espocrm/espocrm/b...mposer.php#L57
Too see how these functions are implemented for Postgresql see this script: https://github.com/espocrm/espocrm/b...mposer.php#L45
Prior to Espo 7.4 the Service Ticket entityDefs json file looked like this:
Code:
"fields" { "ageing" : { "type": "int", "select": "TIMESTAMPDIFF(WEEK, service_ticket.created_at, now())", "readOnly": true, "isCustom": true }, }
ERROR: (42S22) SQLSTATE[42S22]: Column not found: 1054 Unknown column 'service_ticket.created_at' in 'field list'
Code:
"fields" { "ageing" : { "type": "int", "select": { "select": "TIMESTAMPDIFF_WEEK:(createdAt, NOW:())" }, "readOnly": true, "isCustom": true }, }
To see how these functions are implemented for MySql, Maria and similar databases, see this script: https://github.com/espocrm/espocrm/b...mposer.php#L57
Too see how these functions are implemented for Postgresql see this script: https://github.com/espocrm/espocrm/b...mposer.php#L45
Comment