[Vtigercrm-developers] [PATCH] leads module fix (postgres)
Enrico Weigelt
weigelt at metux.de
Thu May 10 18:32:07 PDT 2007
Hi folks,
the leads module (Tracker.php) suffers from an sql bug: it uses
mysql specific sql statements for concatenating fields. This ends
up in empty result objects and so the already mentioned error
of trying to call Move() on non-object.
This patch solves this by using the new PearDatabas::sql_concat()
function (see prev. patch) for creating the statement.
Also this patch calls the new PearDatabase::run_query_field()
for the one-field-query.
cu
--
---------------------------------------------------------------------
Enrico Weigelt == metux IT service
phone: +49 36207 519931 www: http://www.metux.de/
fax: +49 36207 519932 email: contact at metux.de
cellphone: +49 174 7066481
---------------------------------------------------------------------
-- DSL ab 0 Euro. -- statische IP -- UUCP -- Hosting -- Webshops --
---------------------------------------------------------------------
-------------- next part --------------
diff -ruN htdocs.orig/data/Tracker.php htdocs/data/Tracker.php
--- htdocs.orig/data/Tracker.php 2007-05-09 00:56:24.000000000 +0200
+++ htdocs/data/Tracker.php 2007-05-11 03:11:37.000000000 +0200
@@ -80,18 +80,23 @@
$entityidfield = $adb->query_result($result,0,'entityidfield');
if(!(strpos($fieldsname,',') === false))
{
- $fieldlists = explode(',',$fieldsname);
- $fieldsname = "concat(";
- $fieldsname = $fieldsname.implode(",' ',",$fieldlists);
- $fieldsname = $fieldsname.")";
+ // concatenate multiple fields with an whitespace between them
+ $fieldlists = explode(',',$fieldsname);
+ $fl = array();
+ foreach($fieldlists as $w => $c)
+ {
+ if (count($fl))
+ $fl[] = "' '";
+ $fl[] = $c;
+ }
+ $fieldsname = $adb->sql_concat($fl);
}
if($current_module =='Organization') {
$query1 = "select $fieldsname as entityname from $tablename where $entityidfield='".$item_id."'";
} else {
$query1 = "select $fieldsname as entityname from $tablename where $entityidfield=" .$item_id;
}
- $result = $adb->query($query1);
- $item_summary = $adb->query_result($result,0,'entityname');
+ $item_summary = $adb->run_query_field($query1);
}
### Check database item sizes
More information about the vtigercrm-developers
mailing list