We are using SugarCRM 5.1 version and I was creating record in a Notes module in before_save logic hook of Cases module. But it gives me the following error in the error log. Can someone help me to decipher as what I am doing wrong?
PHP Fatal error: Call to a member function query() on a non-object in C:\\SugarCRM\\sugarcrm-5.0.0f\\htdocs\\sugarcrm\\custom\\include\\Cases\\ CaseValidation.php on line 67, referer: http://127.0.0.1/sugarcrm/index.php
I have a class CaseValidation logic hook in Cases module. We tried to move values from one field to the other in the logic hook and it works fine. But the when I create Notes records using logic hooks, it gives me fatal error at query stmt.
$parentid = $bean->id;
$id= create_guid();
echo $id;
echo $parentid;
echo "reached here";
$timestamp=time($bean->date_entered);
echo $timestamp;
$entered_date = date("Y-m-d H:i:s",$timestamp);
echo $entered_date;
$query = "INSERT INTO notes (id,name,description,parent_type,parent_id,date_en tered,date_modified) "."VALUES ('".$id."','name','TEST','Cases','".$parentid."',' ".$entered_date."','".$entered_date."');";
echo $query;
$result = $db->query($query);


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks