(Sorry for my English, but my native language is Spanish)
Hello!
I'm a beginner in SugarCRM, and that maybe I have a question for many people seem simple.
I need to add two fields and display the result in a third field, I found the forum that this is done with logic hook, but I have a lot of confusion in my head, because apparently native modules for SugarCRM is a way for modules and Custom otherwise. I'm confused.
What I have done so far is as follows:
The module is b1c2d_Probabilidades, and its path is C: \ Program Files \ sugarcrm-5.5.1RC \ htdocs \ sugarcrm \ custom \ ModuleBuilder \ builds \ Prob \ SugarModules \ modules \ b1c2d_Probabilidades
Fields are I think add LBL_PLAZO and LBL_ANTECEDENTE, I say "think" because SugarCRM and named them automatically when you create them with the module builder (System Label:LBL_PLAZO) .
So what we've done is:
Create suma.php file in C: \ Program Files \ sugarcrm-5.5.1RC \ htdocs \ sugarcrm \ custom \ ModuleBuilder \ builds \ Prob \ SugarModules \ modules \ b1c2d_Probabilidades \ suma.php
which contains the following code:
if (defined ( 'sugarEntry') | |! sugarEntry) die ( 'Not A Valid Entry Point');
class sum (
calculateField function (& $ focus, $ event, $ arguments) (
$ focus-> amount = $ focus-> LBL_PLAZO + $ focus-> LBL_ANTECEDENTE;
)
)
Then, I modified the file b1c2d_Probabilidades.php, located in
C: \ Program Files \ sugarcrm-5.5.1RC \ htdocs \ sugarcrm \ custom \ ModuleBuilder \ builds \ Prob \ SugarModules \ modules \ b1c2d_Probabilidades \ b1c2d_Probabilidades.php
I modify it as follows:
<?php require_once('modules/b1c2d_Probabilidades/b1c2d_Probabilidades_sugar.php');
class b1c2d_Probabilidades extends b1c2d_Probabilidades_sugar {
function b1c2d_Probabilidades(){
parent::b1c2d_Probabilidades_sugar();
}
//I did from this
function retrieve($id) {
parent::retrieve($id);
$hook_version = 1;
$hook_array = Array();
$hook_array['before_save'] = Array();
$hook_array['before_save'][] = Array(1, 'suma', 'custom\modulebuilder\builds\Prob\SugarModules\mod ules\b1c2d_Probabilidades\suma.php', 'suma', 'suma');
return $this;
}
function save($check_notify = false) {
$hook_version = 1;
$hook_array = Array();
$hook_array['before_save'] = Array();
$hook_array['before_save'][] = Array(1, 'suma', 'custom\modulebuilder\builds\Prob\SugarModules\mod ules\b1c2d_Probabilidades\suma.php', 'suma', 'suma');
parent::save($check_notify);
return $this->id;
}
//to that
}
?>
But it did not work, how do I do? I'm lost?
Please, help me
Thanks a lot
Joeya


LinkBack URL
About LinkBacks




Reply With Quote

Bookmarks