Quantcast
Channel: General Help - FreePBX Community Forums
Viewing all articles
Browse latest Browse all 12672

Superfecta/SugarCRM undefined variable

$
0
0

@elijahmm wrote:

I've been working to integrate SugarCRM (actually SuiteCRM) into Asterisk this morning and started with superfecta. I came across the following error during debug:

Executing SugarCRM
Connecting to database....
Connection failed: SQLSTATE[HY000] [2003] Can't connect to MySQL server on '10.0.1.24' (110)
{"error":{"type":"Whoops\\Exception\\ErrorException","message":"Undefined
 variable: 
wquery_result","file":"\/var\/www\/html\/admin\/modules\/superfecta\/sources\/source-SugarCRM.module","line":110}}

From reviewing the code it appears that this module is attempting to do a mysql_num_rows prior to actually running a query. Furthermore, it appears to be calling mysql_num_rows on $wquery_result which is completely undefined in the SugarCRM modules. Here's the code where I believe the problem resides (line 110:

"if(mysql_num_rows($wquery_result) > 0)  {"  ):
    if ($run_param['Search_Accounts'] == "on") {
                            $sql = "SELECT name FROM accounts WHERE deleted = '0' AND accounts.phone_office REGEXP '" . $thenumberregex . "' OR accounts.phone_alternate REGEXP '" . $thenumberregex . "' OR accounts.phone_fax REGEXP '" . $thenumberregex . "' LIMIT 1";

                        if(mysql_num_rows($wquery_result) > 0)  {
                                $wquery_row = mysql_fetch_array($wquery_result);
                                $wresult_caller_name = $wquery_row["name"];
                        }
                        $sth = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
                        if(!$sth) {
                                $this->DebugPrint("Failed to Prepare the SQL Statement. Are we connected?...Skipping");
                                return null;
                        }
                        $this->DebugPrint("Connected!");
                        $this->DebugPrint("Searching Accounts Database...");
                        $sth->execute(array(':thenumber' => $thenumber));
                        $find = $sth->fetch(PDO::FETCH_BOTH);

                        if($find && is_array($find)) {
                                $this->DebugPrint("Found..");
                                return $find[0];
                        }
                }

Is anybody using the SugarCRM superfecta module successfully?

Posts: 6

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 12672

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>