Skip to content

Instantly share code, notes, and snippets.

# Use the HTTP Connection and SugarCRM API to load the Admin user
SugarCRM.connection.get_entry("Users", 1)
# Retrieve all Accounts by user name (direct API method)
SugarCRM.connection.get_entry_list(
"Users",
"users.user_name = \'sarah\'",
{
:link_fields => [
{
#! /usr/bin/env ruby
require 'rubygems'
require 'sugarcrm'
SugarCRM.connect("http://localhost/sugarcrm", 'user', 'password')
SugarCRM::Account.find_by_name("JAB Funds Ltd.").contacts.each do |contact|
contact.email_addresses.each do |email|
puts "#{email.email_address}" unless email.opt_out == "1"
end
@chicks
chicks / gist:1384007
Created November 21, 2011 21:30
Net::SSH Password Management
require 'net/ssh'
module AccountAdapters
class AdapterHelper
def self.ssh_version(system)
result = false
begin
sshSocket = TCPSocket::new(system.ip_address, 22)
@chicks
chicks / config_si.php
Created June 17, 2012 10:50
SugarCRM Silent Installer
<?php
$sugar_config_si = array(
'setup_db_host_name' => 'localhost',
'setup_db_sugarsales_user' => 'sugarcrm',
'setup_db_sugarsales_password' => 'DB_USER_PASSWORD',
'setup_db_database_name' => 'sugarcrm',
'setup_db_type' => 'mysql',
'setup_db_pop_demo_data' => false,
SUGAR.util.doWhen('$("#cognos").length > 0', function () {
$.ajax({
url:"blah.php",
success:function (data) {
$("#cognos").html(data)
}
})
});
@chicks
chicks / LoginRequest.json
Created July 24, 2012 23:33
Login request
{
"user_auth": {
"user_name": "admin",
"password": "0d107d09f5bbe40cade3de5c71e9e9b7",
"version": 4
},
"application": "sugarcrm_java"
}
@chicks
chicks / EmailUI.php
Created July 25, 2012 20:57
Tree Control
///////////////////////////////////////////////////////////////////////
//// FOLDERS & TreeView
$this->smarty->assign('groupUserOptions', $ie->getGroupsWithSelectOptions(array('' => $app_strings['LBL_EMAIL_CREATE_NEW'])));
$tree = $this->getMailboxNodes();
// preloaded folder
$preloadFolder = 'lazyLoadFolder = ';
$focusFolderSerial = $current_user->getPreference('focusFolder', 'Emails');
if(!empty($focusFolderSerial)) {
@chicks
chicks / gist:3709839
Created September 12, 2012 20:53
SugarCRM on SLES Baseline Cheat Sheet
#! /bin/bash
pkg=../pkg/sugarshell-SLES-6.2.1.tar.gz
host=$1
key=../files/ibmcloud_imagebuilder_rsa
user=idcuser
ssh="ssh -i $key $user@$host"
chkconfig=/sbin/chkconfig
@chicks
chicks / APC Install Instructions
Created September 21, 2012 03:51
Install APC on RHEL 5.5
# Option 1 (from EPEL)
sudo rpm -Uvh http://mirrors.servercentral.net/fedora/epel/5/i386/epel-release-5-4.noarch.rpm
sudo yum install php-pecl-apc
# Option 2 (from PECL), use this if you compiled a custom version of PHP...
sudo yum install php-devel php-pear httpd-devel
sudo pecl install apc
@chicks
chicks / gist:3866904
Created October 10, 2012 16:59
Convert an array of hashes into a CSV
array_of_hashes = [{:a => 1, :b => 2}, {:a => 3, :b => 4}]
csv = array_of_hashes.inject([]) {|csv, hash| csv << hash.values.join(",")}
csv.join("\n")