Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you debug SugarCRM problems/learn how SugarCRM works?

Tags:

php

sugarcrm

I'm in the process of trying to move our company from SalesForce to SugarCRM, but I've run in to a nasty bug (the moment I add a custom field to Accounts, all accounts stop showing up). We've paid for support from the SugarCRM people, but they only have take-forever-then-get-a-worthless-response-level tech support for the open-source version (and we avoid proprietary software like the plague). Oh, and did I mention our Salesforce contract expires at the end of the week?

So, long story short, I'm stuck debugging the SugarCRM app myself. I'm an decently experienced programmer, and I have baseline PHP competency, but I don't even know where to being trying to solve this issue. Can any Sugar developers out there recommend any kind of process for debugging Sugar? Are there any resources out there that would help me to understand what the different PHP files do, or how the Sugar system works overall?

Just as an example of the sort of thing I'm talking about: I figured out how to get sugar to print stack traces, and by following several I noticed a pattern with all the problem lines involving

$this->_tpl_vars
I'd love to try and figure out why that method call isn't working, but I don't know:

A) what _tpl_vars is supposed to do
B) where _tpl_vars is defined
C) what $this is supposed to be
D) where in the framework $this gets set
etc.

So if anyone can help explain how/where I would start finding answers to these questions, I'd be incredibly grateful.

like image 447
machineghost Avatar asked Oct 21 '08 23:10

machineghost


4 Answers

I worked with SugarCRM a couple years ago, and although I loved what I saw on the surface, I ended up rejecting it for our project because of what you are experiencing now. The internals of the product are woefully underdocumented. I had envisioned writing a bunch of slick modules for the product, but the resources just don't exist. You'll spend all your time digging through code, pouring over forum posts, and trying to find examples of what you're trying to accomplish. Doesn't sound like things have gotten much better.

Given that your PHP experience is less-than-guru level, and you're undoubtedly busy with a lot of other tasks and deadlines, I think you should maybe reconsider this transition if it's not too late, at least until you get a better comfort level with Sugar. If you're forced to move to Sugar because of an expiring contract with Salesforce, I think you might be in for some serious heartburn!

like image 158
Nack Avatar answered Sep 21 '22 22:09

Nack


Use the Krumo library to help. It's super easy and way better than var_dump or print_r.

Simply download the source code and add it somewhere in your custom folder. I use the custom/include folder.

Then override a View or whatever you need to look at. Include the path to file class.krumo.php file, and krumo whatever object you want to take a look at:

Quick example -

<?php
  require_once('include/MVC/View/views/view.detail.php');
  require_once('custom/include/krumo/class.krumo.php');
  class AccountsViewDetail extends ViewDetail {

    function AccountsViewDetail() {
      parent::ViewDetail();
    }

    // Override the parent function "preDisplay" to add our own template
    function preDisplay(){
      krumo($this->bean);
      $metadataFile = $this->getMetaDataFile();
      $this->dv = new DetailView2();
      $this->dv->ss =&  $this->ss;
      $this->dv->setup($this->module, $this->bean, $metadataFile, 'custom/modules/Accounts/tpls/AccountsDetailView.tpl');
    }


  }
?>

You'll get a nice object on the page that you can drill into.

enter image description here

like image 33
dkinzer Avatar answered Sep 19 '22 22:09

dkinzer


Although it's not a perfect answer to my question, this article:

http://developers.sugarcrm.com/wordpress/2008/09/26/where-is-the-code-for-x/

did help a bit. Also when I looked further through the official Sugar docs I found that the Developer Guide does contain some explanation of how Sugar works (although obviously it's not as focused on how Sugar works so much as it's focused on how to make Sugar do new things).

Hope that helps any other burgeoning Sugar devs out there.

like image 4
machineghost Avatar answered Sep 21 '22 22:09

machineghost


These code are coming from Smarty lib, not coming from SugarCRM directly.

Maybe this chm doc will be a little helpful, http://code.google.com/p/sugardoc/downloads/list.

like image 2
Leon Avatar answered Sep 20 '22 22:09

Leon