View gist:6294266
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
function usage() | |
{ | |
print("usage: -i /path/to/instance -p /path/to/expanded/module -z /path/to/zipfile\n"); | |
exit(1); | |
} | |
$opts = getopt('i:p:z:'); |
View gist:977301
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function process() | |
{ | |
// Custom SQL | |
$lvsParams = array( | |
'custom_select' => ',calls.id AS call_id', | |
'custom_from' => ' LEFT JOIN calls ON calls.parent_id = accounts.id', | |
'custom_where' => ' AND (calls.id IS NULL)', | |
'distinct' => true |
View gist:5660495
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getRelationshipByModules ($m1, $m2) | |
{ | |
global $db,$dictionary,$beanList; | |
$rel = new Relationship; | |
if($rel_info = $rel->retrieve_by_sides($m1, $m2, $db)){ | |
$bean = BeanFactory::getBean($m1); | |
$rel_name = $rel_info['relationship_name']; | |
foreach($bean->field_defs as $field=>$def){ |
View gist:5984094
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
<!-- | |
function setCookie(name, value, days) { | |
var date = new Date(); | |
date.setTime(date.getTime() + (days*24*60*60*1000)); | |
var expires = "; expires=" + date.toGMTString(); | |
document.cookie = name + "=" + value + expires; | |
} | |
var query = window.location.search.substr(1); |
View gist:825943
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (empty($bean->fetched_row['id']) { | |
// Do custom logic for only a newly created record | |
} |
View gist:6272437
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class FieldChangeHook | |
{ | |
protected static $fetchedRow = array(); | |
/** | |
* Called as before_save logic hook to grab the fetched_row values | |
*/ | |
public function saveFetchedRow($bean, $event, $arguments) |
View gist:5730287
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// specify the REST web service to interact with | |
$baseurl = '<<instanceurl>>/rest/v10'; | |
/** | |
* Authenicate and get back token | |
*/ | |
$curl = curl_init($baseurl . "/oauth2/token"); | |
curl_setopt($curl, CURLOPT_POST, true); |
View gist:3684156
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('include/MVC/View/views/view.list.php'); | |
class CustomAccountsViewList extends ViewList | |
{ | |
/** | |
* @see ViewList::preDisplay() | |
*/ | |
public function preDisplay() |
View gist:3684162
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CustomAccountsController extends SugarController | |
{ | |
public function action_displaypassedids() { | |
if ( !empty($_REQUEST['uid']) ) { | |
$recordIds = explode(',',$_REQUEST['uid']); | |
foreach ( $recordIds as $recordId ) { | |
$bean = SugarModule::get($_REQUEST['module'])->loadBean(); | |
$bean->retrieve($recordId); |
View gist:5844627
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sugarcrm.client; | |
import com.sun.jersey.api.client.Client; | |
import com.sun.jersey.api.client.ClientResponse; | |
import com.sun.jersey.api.client.WebResource; | |
import net.sf.json.JSONObject; | |
public class JerseyClientPost { | |
public static void main(String[] args) { |
NewerOlder