SuiteCRMでカスタムモジュールつくって計算用の新しいフィールドを作る。
カスタムモジュールはほんとに簡単にメタデータがあるのみ。
$bean->total_field = $bean->field1 + $bean->field2; }
before_saveでつくってみた
とりあえず、一つのレコード内で計算はできる。
Step 1. Create custom/modules/(modulename)/logic_hooks.php
Here's a sample code for that, but make sure to specify the name of the module you are working on.
Step 2. Create custom/modules/(modulename)/logic_hooks_class.php.
This is where you tell the system what you want to calculate.
total_field = $bean->field1 + $bean->field2; } } ?>
Step 3. You need to add the field that you defined in the previous step (in the exampled above, it's called "total_field") from within Studio in Sugar CE.
Advice: make sure to pay attention to what the field is called. Some custom fields or modules will be followed with a "_c", so when you may think it's called "price" it's actually called "price_c". You can verify what the field is called from the Studio.
Hope this helps!