I get this warning sign when a user from my web site would try to use the expense (first warning) part of storm. As well as I get other warning signs when a user would try to use the task (2 warning)

* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND ( (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = ' at line 2 query: SELECT COUNT(*) FROM node AS n INNER JOIN stormexpense AS sex ON n.vid=sex.vid INNER JOIN node_access na ON na.nid = n.nid WHERE (sex.expensedate>=1214884800) AND (n.uid=3 OR sex.organization_nid=) AND ( (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'user_relationship_node_access_1') OR (na.gid = 9 AND na.realm = 'user_relationship_node_access_1') OR (na.gid = 3 AND na.realm = 'user_relationship_node_access_author'))) AND ( n.status=1 AND n.type='stormexpense' )) in /home/dynamif9/public_html/green/sites/all/modules/storm/stormexpense/stormexpense.admin.inc on line 137.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND ( (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = ' at line 2 query: SELECT n.*, sex.* FROM node AS n INNER JOIN stormexpense AS sex ON n.vid=sex.vid INNER JOIN node_access na ON na.nid = n.nid WHERE (sex.expensedate>=1214884800) AND (n.uid=3 OR sex.organization_nid=) AND ( (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'user_relationship_node_access_1') OR (na.gid = 9 AND na.realm = 'user_relationship_node_access_1') OR (na.gid = 3 AND na.realm = 'user_relationship_node_access_author'))) AND ( n.status=1 AND n.type='stormexpense' )) ORDER BY sex.expensedate DESC LIMIT 0, 10 in /home/dynamif9/public_html/green/sites/all/modules/storm/stormexpense/stormexpense.admin.inc on line 137.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND ( (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = ' at line 2 query: SELECT SUM(amount) AS t_amount, SUM(vat) AS t_vat, SUM(total) AS t_total FROM node AS n INNER JOIN stormexpense AS sex ON n.vid=sex.vid INNER JOIN node_access na ON na.nid = n.nid WHERE (sex.expensedate>=1214884800) AND (n.uid=3 OR sex.organization_nid=) AND ( (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'user_relationship_node_access_1') OR (na.gid = 9 AND na.realm = 'user_relationship_node_access_1') OR (na.gid = 3 AND na.realm = 'user_relationship_node_access_author'))) AND ( n.status=1 AND n.type='stormexpense' )) in /home/dynamif9/public_html/green/sites/all/modules/storm/stormexpense/stormexpense.admin.inc on line 147.

2cnd warning

* user warning: Not unique table/alias: 'na' query: SELECT COUNT(*) FROM node AS n INNER JOIN stormtask AS sta ON n.vid=sta.vid INNER JOIN node_access na ON na.nid = n.nid INNER JOIN node_access na ON na.nid = stormtask.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'user_relationship_node_access_1') OR (na.gid = 9 AND na.realm = 'user_relationship_node_access_1') OR (na.gid = 3 AND na.realm = 'user_relationship_node_access_author'))) AND ( (sta.taskstatus IN ('inserted','in progress','on hold')) AND (n.uid=3 OR sta.organization_nid=51) AND ( (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'user_relationship_node_access_1') OR (na.gid = 9 AND na.realm = 'user_relationship_node_access_1') OR (na.gid = 3 AND na.realm = 'user_relationship_node_access_author'))) AND ( n.status=1 AND n.type='stormtask' )) ) in /home/dynamif9/public_html/green/sites/all/modules/storm/stormtask/stormtask.admin.inc on line 173.
* user warning: Not unique table/alias: 'na' query: SELECT n.*, sta.* FROM node AS n INNER JOIN stormtask AS sta ON n.vid=sta.vid INNER JOIN node_access na ON na.nid = n.nid INNER JOIN node_access na ON na.nid = stormtask.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'user_relationship_node_access_1') OR (na.gid = 9 AND na.realm = 'user_relationship_node_access_1') OR (na.gid = 3 AND na.realm = 'user_relationship_node_access_author'))) AND ( (sta.taskstatus IN ('inserted','in progress','on hold')) AND (n.uid=3 OR sta.organization_nid=51) AND ( (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'user_relationship_node_access_1') OR (na.gid = 9 AND na.realm = 'user_relationship_node_access_1') OR (na.gid = 3 AND na.realm = 'user_relationship_node_access_author'))) AND ( n.status=1 AND n.type='stormtask' )) ) ORDER BY sta.organization_title ASC LIMIT 0, 10 in /home/dynamif9/public_html/green/sites/all/modules/storm/stormtask/stormtask.admin.inc on line 173.

Thanks again for taking a look. Have a great day. Take care.

Comments

Roberto Gerola’s picture

Status: Active » Closed (won't fix)

It is nodeaccess, not storm.
nodeaccess has no version for D6.

wtopper’s picture

Drupal 6.3 Storm 1.3 -- nodeaccess module is not installed.

I get similar errors under these circumstances:

User has permissions Access=Y, View Own=Y, View All=N
When I switch to View All=Y - errors go away and content appears.

SubModules affected: Expenses, Invoices, Notes, Timetrackings.

Roberto Gerola’s picture

The problems appears to be in this module that you are using : http://drupal.org/project/user_relationships

The only thing that Storm does is to call the method : db_rewrite_sql.
Inside that hook, user_relationships module adds itself two times apparently.

Please, try to disable user_relationships module and tell me if the error goes away. Thanks.

wtopper’s picture

In my case, I don't have user_relationships module installed.

Perhaps this may be simpler to locate than original: Error when accessing notes Notes

* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND ( n.status=1 AND n.type='stormnote' )' at line 1 query: SELECT COUNT(*) FROM d6_node AS n INNER JOIN d6_stormnote AS sno ON n.vid=sno.vid WHERE (n.uid=5 OR sno.organization_nid=) AND ( n.status=1 AND n.type='stormnote' ) in /homepages/24/d204260332/htdocs/tg/demo_tg/modules/storm/stormnote/stormnote.admin.inc on line 89.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND ( n.status=1 AND n.type='stormnote' ) ORDER BY sno.organization_title AS' at line 1 query: SELECT n.title, sno.* FROM d6_node AS n INNER JOIN d6_stormnote AS sno ON n.vid=sno.vid WHERE (n.uid=5 OR sno.organization_nid=) AND ( n.status=1 AND n.type='stormnote' ) ORDER BY sno.organization_title ASC LIMIT 0, 10 in /homepages/24/d204260332/htdocs/tg/demo_tg/modules/storm/stormnote/stormnote.admin.inc on line 89.

Roberto Gerola’s picture

Status: Closed (won't fix) » Fixed

> In my case, I don't have user_relationships module installed.
Fixed in cvs and 1.4 release.

Roberto Gerola’s picture

The fix didn't work very well, now it does : use the cvs version, or be sure
htat every user that access the system has a person associated with his own user
and that the person is correctly associated with an organization.

wtopper’s picture

Understood. Will check it out and report results.

Roberto Gerola’s picture

> I get this warning sign when a user from my web site would try to use the expense (first warning)
>part of storm. As well as I get other warning signs when a user would try to use the task (2 warning)

I found a potential bug, please update to version 1.6

wtopper’s picture

Updated/installed to version 6.x-1.8. Bad news - getting errors as soon as access site.

Two roles of users, Admin (Full rights to all STORM Modules) and Client (Restricted to access/update of user org).

Admin access ok (perhaps a bit slow). Client gets errors on all pages, even front page. Confirmed that that user is assigned to organization via people module.

first error from front page exhibited here:
user warning: Unknown column 'sex1.vid' in 'where clause' query: SELECT r.tid, COUNT(n.nid) AS topic_count, SUM(l.comment_count) AS comment_count FROM d6_node n INNER JOIN d6_node_comment_statistics l ON n.nid = l.nid INNER JOIN d6_term_node r ON n.vid = r.vid WHERE ((case n.type WHEN 'stormexpense' THEN (SELECT IF(n.uid=5,1,0) FROM d6_stormexpense sti1 WHERE sex1.vid=n.vid) WHEN 'storminvoice' THEN (SELECT IF(n.uid=5 OR sin1.organization_nid=2,1,0) FROM d6_storminvoice sin1 WHERE sin1.vid=n.vid) WHEN 'storminvoiceitem' THEN 0 WHEN 'stormknowledgebase' THEN IF(n.uid=5,1,0) WHEN 'stormnote' THEN (SELECT IF(n.uid=5 OR sno1.organization_nid=2,1,0) FROM d6_stormnote sno1 WHERE sno1.vid=n.vid) WHEN 'stormorganization' THEN (SELECT IF(n.uid=5 OR sor1.nid=2,1,0) FROM d6_stormorganization sor1 WHERE sor1.vid=n.vid) WHEN 'stormperson' THEN (SELECT IF(n.uid=5 OR spe1.organization_nid=2,1,0) FROM d6_stormperson sti1 WHERE spe1.vid=n.vid) WHEN 'stormproject' THEN (SELECT IF(n.uid=5 OR spr1.organization_nid=2,1,0) FROM d6_stormproject spr1 WHERE spr1.vid=n.vid) WHEN 'stormtask' THEN (SELECT IF(n.uid=5 OR sta1.organization_nid=2,1,0) FROM d6_stormtask sta1 WHERE sta1.vid=n.vid) WHEN 'stormticket' THEN (SELECT IF(n.uid=5 OR sti1.organization_nid=2,1,0) FROM d6_stormticket sti1 WHERE sti1.vid=n.vid) WHEN 'stormtimetracking' THEN (SELECT IF(stt1.organization_nid=2,1,0) FROM d6_stormtimetracking stt1 WHERE stt1.vid=n.vid) else 1 end)=1) AND ( n.status = 1 )GROUP BY r.tid in /homepages/24/d204260332/htdocs/tg/demo_tg/modules/forum/forum.module on line 511.

Roberto Gerola’s picture

Should be fixed in version 1.9.

wtopper’s picture

Installed latest update 6.x-1.10 -- Vast majority of issues resolved.

Only remaining instance is on node q=storm/people. When accessed receive:

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHEN 'storminvoice' THEN (SELECT IF(n.uid=5 OR sin1.organization_nid=2,1,0) FROM' at line 1 query: SELECT n.nid, n.title FROM d6_stormorganization sor INNER JOIN d6_node n ON sor.vid=n.vid WHERE (n.uid=5 OR n.nid=2 AND 'storm_access'='storm_access' ) AND ( ((case n.type WHEN 'stormexpense' THEN (SELECT IF(n.uid=5,1,0) FROM d6_stormexpense sex1 WHERE (n.uid=5 OR n.nid=2 AND 'storm_access'='storm_access' ) AND ( sex1.vid=n.vid) WHEN 'storminvoice' THEN (SELECT IF(n.uid=5 OR sin1.organization_nid=2,1,0) FROM d6_storminvoice sin1 WHERE (n.uid=5 OR n.nid=2 AND 'storm_access'='storm_access' ) AND ( sin1.vid=n.vid) WHEN 'storminvoiceitem' THEN 0 WHEN 'stormknowledgebase' THEN IF(n.uid=5,1,0) WHEN 'stormnote' THEN (SELECT IF(n.uid=5 OR sno1.organization_nid=2,1,0) FROM d6_stormnote sno1 WHERE (n.uid=5 OR n.nid=2 AND 'storm_access'='storm_access' ) AND ( sno1.vid=n.vid) WHEN 'stormorganization' THEN (SELECT IF(n.uid=5 OR sor1.nid=2,1,0) FROM d6_stormorganization sor1 WHERE (n.uid=5 OR n.nid=2 AND 'storm_access'='storm_access' ) AND ( sor1.vid=n.vid) WHEN 'stormperson' THEN (SELECT IF(n.uid=5 OR spe1.organization_nid=2,1,0) FROM d6_stormperson spe1 WHERE (n.uid=5 OR n.nid=2 AND 'storm_access'='storm_access' ) AND ( spe1.vid=n.vid) WHEN 'stormproject' THEN (SELECT IF(n.uid=5 OR spr1.organization_nid=2,1,0) FROM d6_stormproject spr1 WHERE (n.uid=5 OR n.nid=2 AND 'storm_access'='storm_access' ) AND ( spr1.vid=n.vid) WHEN 'stormtask' THEN (SELECT IF(n.uid=5 OR sta1.organization_nid=2,1,0) FROM d6_stormtask sta1 WHERE (n.uid=5 OR n.nid=2 AND 'storm_access'='storm_access' ) AND ( sta1.vid=n.vid) WHEN 'stormticket' THEN (SELECT IF(n.uid=5 OR sti1.organization_nid=2,1,0) FROM d6_stormticket sti1 WHERE (n.uid=5 OR n.nid=2 AND 'storm_access'='storm_access' ) AND ( sti1.vid=n.vid) WHEN 'stormtimetracking' THEN (SELECT IF(stt1.organization_nid=2,1,0) FROM d6_stormtimetracking stt1 WHERE (n.uid=5 OR n.nid=2 AND 'storm_access'='storm_access' ) AND ( stt1.vid=n.vid) else 1 end)=1) AND ( n.status=1 AND n.type='stormorganization' )) ORDER BY n.title in /homepages/24/d204260332/htdocs/tg/demo_tg/modules/storm/stormperson/stormperson.admin.inc on line 97.

It's a dev site so cache mode is "off".

Roberto Gerola’s picture

It should fixed in cvs now, thanks.

Download from there the latest stormperson.admin.inc module

wtopper’s picture

CVS version resolves issue. Looking good.

Dynamic Ecology’s picture

You people rock! Thanks so much for all your help and support!

A

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.