SYSTEM: Slackware 14.0
EPESI: epesi-1.4.2-rev10136
WEB: Apache 2.4.3
PHP: 5.4.11
DB: PostgreSQL 9.2.3
Few days ago a installed Epesi include all free premium modules. It looks very well, so i'm testing it and preparing for production use. I know, PostgreSQL is not the major DB for web development, but for me is important. EPESI is probably tested on MySQL and so, there are some bugs related to other databases. There is the first, what i found.
PostgreSQL doesn't like doublequotes as string separators and in INSERT statement, the construction INSERT INTO ... ON DUPLICATE ... is not valid.
So there is my first patch for ContactPhotos. I hope, it doesn!t break MySQL.
Hm, i can!t upload the patch, extension patch is not allowed, extension txt is not allowed, bettes is exe ? ;-)
So there is it in message body:
diff --git a/modules/CRM/Contacts/Photo/PhotoCommon_0.php b/modules/CRM/Contacts/Photo/PhotoCommon_0.php
index 1d91121..eb2689a 100644
--- a/modules/CRM/Contacts/Photo/PhotoCommon_0.php
+++ b/modules/CRM/Contacts/Photo/PhotoCommon_0.php
@@ -40,7 +40,7 @@ class CRM_Contacts_PhotoCommon extends ModuleCommon {
public static function add_photo($contact_id, $filename) {
self::del_photo($contact_id, $filename);
- DB::Execute('INSERT INTO '.self::table_name.' VALUES (%d,%s) ON DUPLICATE KEY UPDATE filename=%s', array($contact_id, $filename, $filename));
+ DB::Execute('INSERT INTO '.self::table_name.' VALUES (%d,%s)', array($contact_id, $filename));
}
public static function get_photo($contact_id) {
@@ -53,7 +53,7 @@ class CRM_Contacts_PhotoCommon extends ModuleCommon {
$in = self::Instance();
unlink($in->get_data_dir() . $filename);
- DB::Execute('DELETE FROM `'.self::table_name.'` WHERE `contact_id`=%d', array($contact_id));
+ DB::Execute('DELETE FROM '.self::table_name.' WHERE contact_id=%d', array($contact_id));
}
}