backdrop-contrib / ubercart

A flexible but easy-to-use e-commerce system for Backdrop.
https://backdropcms.org/project/ubercart
GNU General Public License v2.0
4 stars 10 forks source link

Missing table error in class uc_roles_handler_field_rid #481

Closed bugfolder closed 9 months ago

bugfolder commented 9 months ago

The uc_roles module contains Views support, including a handler, uc_roles_handler_field_rid, to display the role name of a role that has been made a feature of a product. However, the current handler throws a db error when attempting to render:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'my_db.role' doesn't exist: SELECT r.role, r.name FROM {role} r WHERE r.role IN (:rids_0) ORDER BY r.name; Array ( [:rids_0] => my_rid ) in uc_roles_handler_field_rid->pre_render() (line 28 of /mysite/modules/contrib/ubercart/uc_roles/views/uc_roles_handler_field_rid.inc).

The problem is that the views handler is referring to the now-nonexistent roles table, because roles are now stored in config.

This can be easily fixed, though, by using the core user_roles() routine to get the role names.

PR to follow.

argiepiano commented 9 months ago

LGTM!

bugfolder commented 9 months ago

Yeah, this showed up on a live site, and the fix is working on the live site, so I went ahead and merged it. Thanks for the look-see!