0

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);
            }
        }
    }
?> 

which I found here

And can I use SQL queries in code like this to get other module's field's content to a field in an other?

Karl Hill
  • 12,937
  • 5
  • 58
  • 95
kpg9
  • 81
  • 1
  • 8

1 Answers1

3

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

Sugar_Developer

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.

Code Lღver
  • 15,573
  • 16
  • 56
  • 75
the_pete
  • 822
  • 7
  • 19