Notes about Sugar
Lead Capture
- read ths fine post: http://www.sugarcrm.com/forums/showthread.php?t=4467
API notes
Check out the SOAP api.
New bugs/workarounds in Email Templates
Okay. There's some painful things here. First of all, percent signs do not work--I guess they aren't escaped in a SQL query, or something.
- Line break characters are converted to break tags in the email compose window. Not sure where this is happening, but the problem is copying text from OOo into Sugar--lines have arbitrary breaks in them. Solution: copy/paste raw HTML (we did this from PHPMyAdmin) into a temp file, strip newlines from the temp file, copy the file to the clipboard and finally back into the raw HTML:
- dump into service.txt
Bugs
In version 3.0.1, we're running into a few bugs in the email module, using email templates.
- Double-quotes are not properly escaped. Solution: Escape double-quotes in template editors with a backslash.
- Percent signs (%) are not escaped. Escaping them does not appear to work. Solution: Spell out percent.
- Mail is only sent to the Account contact and BCC--I put in multiple "To" addresses, and one CC address, and only the BCC and first TO actually delivered.
Things we needed to move:
- custom/include/language/en_us.php
<script> function fill_email(id)
{
if (id == '')
{
// query based on template, contact_id0,related_to
if ( ! append )
{
document.EditView.name.value = '';
document.EditView.description.value = '';
document.EditView.description_html.value = '';
}
return;
}
call_json_method('EmailTemplates','retrieve','record='+id,'email_template_object',appendEmailTemplateJSON);
}
function appendEmailTemplateJSON()
{
// query based on template, contact_id0,related_to
if ( append )
{
document.EditView.name.value += decodeURI(json_objects['email_template_object']['fields']['subject']);
document.EditView.description.value += decodeURI(json_objects['email_template_object']['fields']['body']).replace(/
/ig, '\n');
document.EditView.description_html.value += decodeURI(json_objects['email_template_object']['fields']['body_html']);
}
else
{
document.EditView.name.value = decodeURI(json_objects['email_template_object']['fields']['subject']);
document.EditView.description.value = decodeURI(json_objects['email_template_object']['fields']['body']).replace(/
/ig, '\n');
html_editor.setHTML(decodeURI(json_objects['email_template_object']['fields']['body_html']));
}
}
//--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> //--> </script>
Notes:
- HMTL comments seem to break the template. I tried adding an HTML comment to point out my changes, and the script never appeared in the output file. It basically removed all content up until the next placeholder.
- Email now has an HTML and a non-HTML component. I don't see anything that synchronizes the two--will have to test. Personally, I'd prefer to have some ability to turn HTML emails off, and just use plain text (lowest common denominator and all).
- If you actually read the script above, you'll see that we only write to the HTML Editor object in the replace case, not in the append. You can get the append text to appear by switching between source view and HTML view. Or rewrite that code to use html_editor.getHTML(), append the text, and continue. We're not sure this is appropriate, though--I don't think appending HTML is going to work all that well in the first place. Maybe...
- We also found in the EditView.php file that the code supports the FCKeditor, in addition to/instead of HTMLArea. We're not liking HTMLArea all that much, because in Firefox you have to disable some security settings to get paste to work. But we haven't gotten FCKeditor to work in Sugar, even after unpacking it and getting the paths right. When we do, this script will likely need to be changed to call the relevant FCKeditor method instead of the HTMLArea method. Obviously, we haven't done much error checking here...
iCal
We're using the iCal patch available here: http://www.sugarforge.org/frs/?group_id=161. This allows us to subscribe to our Sugar calendar in Evolution, as well as Mozilla Calendar and iCal. We publish our free/busy calendars from Evolution, too.
The one drawback with this patch is that it makes our free/busy info private. We'll have to look into patching the patch to allow public viewing of free/busy, while preserving private viewing of ics. Patched.
So now, we publish free/busy information from Evolution, using the URL listed in the account page in SugarCRM. We then subscribe to the same URL as a WebDAV calendar, except changing the type from "vfb" to "ics", and our Sugar calls now show up in our Evolution calendar. This list also shows up in Thunderbird, in the Mozilla Calendar extension.
That's one step closer to the killer small business calendar system...
Scheduled Jobs (SugarCRM 4.0)
We had trouble getting scheduled jobs to work, when configuring inbound email. There were two main issues: a permissions issue on a directory where the job creates a temporary PID file, and our SSL certificate, which isn't recognized by the Curl library.Issue 1 cropped up because we ran the cron job as a normal user. The first time it ran, it created a directory with default permissions, which prevented Apache from writing to it. So after running the cron job the first time, the fix was to chmod 777 cache/modules/*.
Issue 2 took adding the Curl option to not verify SSL certificates. This was in modules/SchedulersJob/SchedulersJob.php, inserting at line 168:
- Freelock fix for freessl
Asterisk integration
Asterisk @ Home has a built-in SugarCRM package modified with "call" buttons. This functionality is fairly simple to migrate over to other SugarCRM implementations. Here's how:-
Edit /etc/asterisk/manager_custom.conf and create or modify a user to allow access from the SugarCRM box, either by subnet or host. The secret is the password you use to authenticate the call request.
-
Copy the callme.php script and the phpagi directory from /var/www/html/crm to your regular SugarCRM installation.
-
Edit the callme.php script as follows:
- Change the include path at the top of the file to point to your phpagi directory.
- and change it to this:
- Now it's time to edit the Sugar files. Find the {PHONE_WORK}, {PHONE_HOME} blocks in modules/Contacts/DetailView.html. There are four of them, for work, mobile, home, and other. These represent phone number types 0, 1, 2, and 3 respectively. Immediately after each block, add a non-breaking space and a link to the callme script (change the type to match the number you're showing):
{PHONE_HOME}
- change to
{PHONE_HOME} {PHONE_WORK_CALL}
5. In the modules/Contacts/DetailView.php, after the block of defines, we need to create the template placeholders:
if (!empty($focus->phone_home)) $xtpl->assign("PHONE_HOME_CALL", "[call]");
if (!empty($focus->phone_mobile)) $xtpl->assign("PHONE_MOBILE_CALL", "[call]");
if (!empty($focus->phone_work)) $xtpl->assign("PHONE_WORK_CALL", "[call]");
if (!empty($focus->phone_other)) $xtpl->assign("PHONE_OTHER_CALL", "[call]");
6. In modules/Contacts/ListView.html, add the call me link:
{CONTACT.PHONE_WORK}
- change to
{CONTACT.PHONE_WORK} [call]
7. Now we need to associate an extension with a user. I did this by using the custom field layout editor in Sugar to create an "extension" field associated with a user. I added it to Users/ListView, Users/EditView, and Users/DetailView. Then I used phpMyAdmin to find where it stored the data, in a user_cstm table, and modified the query in callme.php to look up the right column in the right table. Note that you need to put your extension in the form "SIP/20" to get the context right...
Note that the callme script looks up in the Sugar contact database directly. It'll need some modification to get it to look up in the Accounts or Leads table--right now this only works for contacts, and only in the Contacts module or in a search--for some reason, it's not appearing in contacts listed in the Account module. Also, in Sugar 3.5.1, anyway, the "Call" link appears whether there's a number there or not...
But you now have single-click dialing from Sugar!
Migrating SugarCRM to Trixbox
We recently got new hardware for Asterisk, and installed the latest Trixbox. Because it's a nice speedy machine, we decided to move our main SugarCRM database over to it and run it there.Here's what we did:
- Upgrade both the old (original) Sugarcrm and new (Trixbox) SugarCRM to the same version (at this writing, 4.2.1a).
- Move the trixbox db out of the way, and copy the old database to the Trixbox machine.
- Copy over the files in the old sugarcrm/custom/ directory to the trixbox /var/www/html/crm/custom directory.
- Install the Asterisk VoiceRD extension from http://www.sugarforge.org/projects/asterisk-int/ (currently version 1.2).