Skip to content

Instantly share code, notes, and snippets.

@eggsurplus
Created November 8, 2012 16:46
Show Gist options
  • Select an option

  • Save eggsurplus/4039986 to your computer and use it in GitHub Desktop.

Select an option

Save eggsurplus/4039986 to your computer and use it in GitHub Desktop.
Manifest Utils Directive in a SugarCRM Module - Function
// /extensions/application/utils/contract_products_utils.php
function getProducts(){
static $products = null;
if(!$products){
global $db;
$query = "SELECT id, name FROM products where deleted = 0 order by name asc ";
$result = $db->query($query, false);
$products = array();
$products[''] = '';
while (($row = $db->fetchByAssoc($result)) != null) {
$products[$row['id']] = $row['name'];
}
}
return $products;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment