tags:

views:

1153

answers:

7

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.

+2  A: 

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.

machineghost
+4  A: 

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!

Nack
A: 

$this is a reference to the current object.

class Test {

    var $tmp;

    function __construct() {
     $this->tmp = 42; 
    }
}
Kevin
+1  A: 

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.

leon
+1  A: 

You can also try installing xdebug (PHP extension) and stepping through the code with a compatible IDE such as eclipse or Komodo.

The URL tells you which module directory is being accessed and which action/view. There's a "views" folder under most modules. If it's not there, it's either using the default MVC view in the include folder in conjunction with the metadata layout, or it's using the classic view architecture: index.php (listview), DetailView.php, and EditView.php and templates.

A lot has changed for the better in the last couple years, so I'm not sure the first answer (Nack) is still relevant. It's still pretty rough around the edges, but the new Sugar framework is a PHP hacker's best friend (really easy to override stuff in an upgrade-friendly manner). It's great for companies who happen to already have PHP hackers and only need a few enhancements. And finding affordable PHP contractors to help out isn't that hard (disclaimer: I am one). I think it's a great tool if you're into open source, just need basic CRM and have fewer than 100 users.

webXL
"finding affordable PHP contractors" with a good understanding of SugarCRM should be hard. Just because you know php well, doesn't help you that much with SugarCRM. Sugar is a very big, complex php app, it takes lot's of time to really figure out SugarCRM (not sayint that I do or ever will truly understand Sugar)
AntonioCS
A: 

I'd suggest making sure that it really is a code bug and not just a miss config. Are you adding the field through Admin > Studio > Contacts > Fields or through the SOAP API ?

Are you using the latest version of Sugar?

I really agree that the project it horribly under-documented and lacking in tutorials and examples.

I myself am experiencing the pains of outdated / missing documentation. Good luck!

Ped
A: 

tpl is smarty template files. They are used when displaying data on screen. How i do my debuging proces is create a lot of var dumps to error lof or just print them on screen.

Also get xdebug on the server, this will help you a lot. Sugar is mvc platform so get knowing how that works, and will be much easier then.

take a look at some snippets i post at www.eontek.rs

Eitrix