Closed (fixed)
Project:
VoIP Drupal
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Apr 2012 at 15:04 UTC
Updated:
23 May 2012 at 15:40 UTC
Jump to comment: Most recent file
Comments
Comment #1
Syntapse commentedAttempting to access VOIP scripts in main menu:
Fatal error: Call to a member function execute() on a non-object in C:\vhosts\Drupal\voip_1_0\sites\all\modules\voipdrupal\modules\voipscriptui\voipscriptui.module on line 16
Comment #2
freescholar commentedJust a few questions about your setup:
Did you make sure that Twilio is selected as the default server in your Default Server Configuration within the VoIP Drupal Administrative settings?
Do you have Views installed and enabled?
You need Views to see the Voipscripts.
Also -check for typos in your Inbound and Outbound Tokens
To troubleshoot, you can install Tropo VoIP Drupal modules and set up a tropo.com account (free) and see if you get the same errors.
Comment #3
js commentedI have this error testing with Tropo.
Yes, Views is installed.
I am confused by the query in
\sites\all\modules\voipdrupal\modules\voipscriptui\voipscriptui.module on line 16
if this is what we are wishing to change to D7
//$query = db_select('node', n.title FROM {node} n WHERE n.type = :n.type and n.status = :n.status', array(':n.type' => "voipscriptui", ':n.status' => 1));
I don't understand the join here,
$query = db_select('node', 'n')
->join('title', 'n', ':n.type = voipscriptui :n.status = 1', array(':n.type' => "voipscriptui", ':n.status' => 1));
or the syntax. Isn't there a missing "AND" between the conditions?
The object error goes away with this
$query = db_select('node', 'n');
$query->join('title', 'n', ':n.type = voipscriptui :n.status = 1', array(':n.type' => "voipscriptui", ':n.status' => 1));
which gives
SELECT FROM {node} n
INNER JOIN {title} n_2 ON :n.type = voipscriptui :n.status = 1
as a suggestion:
$query = db_select('node', 'n');
$query
->fields('n', array('title'));
->condition('n.type', 'voipscriptui')
->condition('n.status', '1');
yields:
SELECT n.title AS title FROM {node} n WHERE (n.type = :db_condition_placeholder_0) AND (n.status = :db_condition_placeholder_1)
which seems to work for the "foreach" that follows
This should work fine too:
->fields('n')
Comment #4
js commentedI should mention that the query appears to run three times. I am not sure why. It could be cached, but if this only runs as an admin function , then it likely doesn't matter very much.
Comment #5
ben.bunk commentedBased on a first pass review your suggestion makes sense. I haven't opened the D6 code to verify the original intent but based on what was in the comment in the coder conversion it appears correct:
JS - Please put this change into a patch so we can get it tested and I'll commit it to the repo.
Thank you,
Ben
*Copy and Paste Patch Directions for VoIP Drupal can be found here - http://drupal.org/node/1072578/git-instructions
Comment #6
js commentedSorry, but I have not submitted a patch before, and I have not worked with git.
Also, there appear to be more errors in the D7 code and I just wanted to test voipdrupal, so I abandoned D7 and switched to D6.
I am interested in pursuing this for a project that is important to me, and would really need to the D7 port. As such, I would be willing to help but learning all of the code is more than I can undertake. I would be happy to debug and also to contract for some help.
I have attached a patch file which I made using diff -u. Does this help/work?
Comment #7
tamerzg commentedI rewrote the query to a D7 version. This error should be fixed now.