chicks / sugarcrm

A ruby based REST Client for SugarCRM
MIT License
90 stars 64 forks source link

User/Employees Suddenly Not Working #117

Open StrangeWill opened 8 years ago

StrangeWill commented 8 years ago
[1] pry(main)> ::SugarCRM.connect('[siteurl]', '[user]', '[pass]')
=> SugarCRM::Namespace0
[2] pry(main)> ::SugarCRM::User.first                    
NameError: uninitialized constant SugarCRM::User
from /usr/local/bundle/bundler/gems/sugarcrm-360060139b13/lib/sugarcrm/module_methods.rb:88:in `const_missing'

::SugarCRM.connection.get_entry("Users", 1) fails too.

So far all other modules seem to work fine. I've attempted rolling back code each release for a month, all exhibit the same issue.

Trying to hunt down why, started 6 days ago, fairly sporadic, I'm tempted to chalk this up to something SugarOnDemand is doing but figured I'd mention it here in case anyone else is experiencing issues (though it starting on a day that I had released software I had suspected a Gem conflict...).

Modules are missing from the modules list -- logged in as an admin.

StrangeWill commented 8 years ago
[10] pry(main)> ::SugarCRM.session.connection.get_modules.each { |x| puts x.name } ; 0
get_available_modules: Request:
{
  "session": "[sessionid]"
}

get_available_modules: JSON Response:
{"modules"=>
  ["Home",
   "Calls",
   "Meetings",
   "Tasks",
   "Notes",
   "Reports",
   "Leads",
   "Contacts",
   "Accounts",
   "Opportunities",
   "Emails",
   "Campaigns",
   "Quotes",
   "Products",
   "Forecasts",
   "Contracts",
   "Documents",
   "Cases",
   "Project",
   "Bugs",
   "Tags",
   "KBContents",
   "ops_Backups",
   "esb_QB_Line_Items",
   "esb_QB_Transactions"]}

Something is up... and I've run out all doubt it's not a code issue at this point.

StrangeWill commented 8 years ago

Known problem with 7.7.1.1:

https://web.sugarcrm.com/support/issues/357e6957-f0c0-6886-5dcc-57d85eec993c

Awaiting fix, may provide a workaround here if they don't fix it soon...

chicks commented 8 years ago

Thanks for the update!

StrangeWill commented 8 years ago

I just ended up shimming the API call here:

https://github.com/chicks/sugarcrm/blob/master/lib/sugarcrm/connection/api/get_available_modules.rb

    mods = send!(:get_available_modules, json)["modules"]
    mods += %w(Employees Users)
    modules = []

It's terrible but I think preforms as a decent shim (assuming your user isn't going to be denied these modules for any reason). Still no word on a fix from Sugar though.

chicks commented 8 years ago

Cool - sometimes the old tricks are the best tricks :)