Reputation: 91
What does $bean
stand for in this code:
<?php
// prevents directly accessing this file from a web browser
if (!defined('sugarEntry') || !sugarEntry)
die('Not A Valid Entry Point');
class Process {
function process(&$bean, $event) {
// calculate item profit
$bean->t_profit_c = ($bean->t_sale_price_c - $bean->t_item_cost_c);
// calculate sale profit
if (!empty($bean->t_qty_sold_c)) {
$bean->t_sale_profit_c = ($bean->t_qty_sold_c * $bean->t_profit_c);
}
}
}
?>
And can I use SQL queries in code like this to get other module's field's content to a field in an other?
Upvotes: 0
Views: 1244
Reputation: 822
The $bean is an object, or set of objects used by SugarCRM to allow the user to access database information quickly and easily. Working with them should be pretty easy:
how to using the bean instead of sql all the time
In your instance, the &$bean
is an object, passed by reference that holds all the attributes of the item you gave it in step 3 of your link.
Upvotes: 3