public function formatDate($date, $daysToAdd) { $dateTime = new DateTime($date); // Change the format accordingly $dateTimeFormatted = $dateTime->format('Y-m-d h:m:s'); return str_replace(' ', 'T', $dateTimeFormatted); }
Wednesday, April 26, 2017
PHP: Formatting Date Specified as YYYY-MM-DDT00:00:00
JavaScript: Constructing a Simple JSON Object Dynamically
1. Create an initial JSON object with a single element and an array: // {$id} is a PHP variable but it can be anything else jsonObj = {"id" : "{$id}", "myArray": []}; 2. Construct the JSON object item = {} item ["id"] = "some Id"; item ["value"] = "Some Value"; jsonObj.myArray.push(item); 3. Output JavaScript: Object {id: "564f48ba-e9d5-463a-2325-58f91c653aa8", myArray: Array(1)} where myArray is broken down as follows: myArray: Array(3) 0: Object id: "Some Id", value: "Some Value" 4. Output PHP: Array ( [id] => 564f48ba-e9d5-463a-2325-58f91c653aa8 [myArray] => Array ( [0] => Array ( [id] => Some Id [value] => Some Value ) ) )
Tuesday, April 25, 2017
Friday, April 21, 2017
SUGARCRM: Querying Results using Raw SQL Statements
$sql = "SELECT id FROM accounts WHERE deleted = 0";
$result = $GLOBALS['db']->query($sql);
while($row = $GLOBALS['db']->fetchByAssoc($result) )
{
//Use $row['id'] to grab the id fields value
$id = $row['id'];
}
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.8/Data_Framework/Database/DBManagerFactory/
SUGARCRM: Getting blank Page on Entry Point
Make sure your Entry point is registered in your instance:
/custom/Extension/application/Ext/EntryPointRegistry/<your entry point>
/custom/Extension/application/Ext/EntryPointRegistry/<your entry point>
Thursday, April 20, 2017
SUGARCRM 7.8: Obtaining Field Labels based on Module Names
require_once('include/utils.php');
$label = translate('LBL_KEY', 'Accounts');
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.8/Architecture/Languages/Module_Labels/index.html
Subscribe to:
Posts (Atom)