grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026query($query.')');
$i=-1;
while (($row=$db->fetchByAssoc($result)) != null) {
$i++;
$rows[$i] = $row;
}
if ($i==-1) {
return null;
}
return $rows;
}
return null;
}
public function buildTableForm($rows, $mod='Opportunities')
{
if (!empty($mod)) {
global $current_language;
$mod_strings = return_module_language($current_language, $mod);
} else {
global $mod_strings;
}
global $app_strings;
$cols = sizeof($rows[0]) * 2 + 1;
$form = '
| '.$mod_strings['MSG_DUPLICATE']. ' |
|
';
$form .= "";
return $form;
}
public function getForm($prefix, $mod='Opportunities')
{
if (!ACLController::checkAccess('Opportunities', 'edit', true)) {
return '';
}
if (!empty($mod)) {
global $current_language;
$mod_strings = return_module_language($current_language, $mod);
} else {
global $mod_strings;
}
global $app_strings;
global $sugar_version, $sugar_config;
$lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
$lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
$lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
$the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
$the_form .= <<
EOQ;
$the_form .= $this->getFormBody($prefix, $mod, "{$prefix}OppSave");
$the_form .= <<
EOQ;
$the_form .= get_left_form_footer();
$the_form .= get_validate_record_js();
return $the_form;
}
public function getWideFormBody($prefix, $mod='Opportunities', $formname='', $lead='', $showaccount = true)
{
if (!ACLController::checkAccess('Opportunities', 'edit', true)) {
return '';
}
if (empty($lead)) {
$lead = new Lead();
}
global $mod_strings, $sugar_config;
$showaccount = $showaccount && $sugar_config['require_accounts'];
$temp_strings = $mod_strings;
if (!empty($mod)) {
global $current_language;
$mod_strings = return_module_language($current_language, $mod);
}
global $app_strings;
global $app_list_strings;
global $theme;
global $current_user;
global $timedate;
// Unimplemented until jscalendar language files are fixed
// global $current_language;
// global $default_language;
// global $cal_codes;
$lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
$lbl_opportunity_name = $mod_strings['LBL_OPPORTUNITY_NAME'];
$lbl_sales_stage = $mod_strings['LBL_SALES_STAGE'];
$lbl_date_closed = $mod_strings['LBL_DATE_CLOSED'];
$lbl_amount = $mod_strings['LBL_AMOUNT'];
$lbl_probability = $mod_strings['LBL_PROBABILITY'];
$json = getJSONobj();
$prob_array = $json->encode($app_list_strings['sales_probability_dom']);
//$prePopProb = '';
//if(empty($this->bean->id))
$prePopProb = 'document.getElementsByName(\''.$prefix.'sales_stage\')[0].onchange();';
$probability_script=<<
prob_array = $prob_array;
document.getElementsByName('{$prefix}sales_stage')[0].onchange = function() {
if(typeof(document.getElementsByName('{$prefix}sales_stage')[0].value) != "undefined" && prob_array[document.getElementsByName('{$prefix}sales_stage')[0].value]) {
document.getElementsByName('{$prefix}probability')[0].value = prob_array[document.getElementsByName('{$prefix}sales_stage')[0].value];
}
};
$prePopProb
EOQ;
$ntc_date_format = $timedate->get_user_date_format();
$cal_dateformat = $timedate->get_cal_date_format();
if (isset($lead->assigned_user_id)) {
$user_id=$lead->assigned_user_id;
} else {
$user_id = $current_user->id;
}
// Unimplemented until jscalendar language files are fixed
// $cal_lang = (empty($cal_codes[$current_language])) ? $cal_codes[$default_language] : $cal_codes[$current_language];
$cal_lang = "en";
$the_form="";
if (isset($lead->opportunity_amount)) {
$opp_amount=$lead->opportunity_amount;
} else {
$opp_amount='';
}
$the_form .= <<
| $lbl_opportunity_name $lbl_required_symbol |
{$mod_strings['LBL_DESCRIPTION']} |
|
|
| $lbl_date_closed $lbl_required_symbol |
| |
EOQ;
if ($showaccount) {
$the_form .= <<
${mod_strings['LBL_ACCOUNT_NAME']} ${lbl_required_symbol} |
| |
EOQ;
}
$the_form .= <<
$lbl_sales_stage $lbl_required_symbol |
|
| $lbl_amount $lbl_required_symbol |
|
EOQ;
//carry forward custom lead fields to opportunities during Lead Conversion
$tempOpp = new Opportunity();
if (method_exists($lead, 'convertCustomFieldsForm')) {
$lead->convertCustomFieldsForm($the_form, $tempOpp, $prefix);
}
unset($tempOpp);
$the_form .= <<
EOQ;
$javascript = new javascript();
$javascript->setFormName($formname);
$javascript->setSugarBean(new Opportunity());
$javascript->addRequiredFields($prefix);
$the_form .=$javascript->getScript();
$mod_strings = $temp_strings;
return $the_form;
} // end getWideFormBody
public function getFormBody($prefix, $mod='Opportunities', $formname='')
{
if (!ACLController::checkAccess('Opportunities', 'edit', true)) {
return '';
}
if (!empty($mod)) {
global $current_language;
$mod_strings = return_module_language($current_language, $mod);
} else {
global $mod_strings;
}
global $app_strings;
global $app_list_strings;
global $theme;
global $current_user;
global $sugar_config;
global $timedate;
// Unimplemented until jscalendar language files are fixed
// global $current_language;
// global $default_language;
// global $cal_codes;
$lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
$lbl_opportunity_name = $mod_strings['LBL_OPPORTUNITY_NAME'];
$lbl_sales_stage = $mod_strings['LBL_SALES_STAGE'];
$lbl_date_closed = $mod_strings['LBL_DATE_CLOSED'];
$lbl_amount = $mod_strings['LBL_AMOUNT'];
$ntc_date_format = $timedate->get_user_date_format();
$cal_dateformat = $timedate->get_cal_date_format();
$user_id = $current_user->id;
// Unimplemented until jscalendar language files are fixed
// $cal_lang = (empty($cal_codes[$current_language])) ? $cal_codes[$default_language] : $cal_codes[$current_language];
$cal_lang = "en";
$the_form = <<
$lbl_opportunity_name $lbl_required_symbol
EOQ;
if ($sugar_config['require_accounts']) {
///////////////////////////////////////
///
/// SETUP ACCOUNT POPUP
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => "{$prefix}OppSave",
'field_to_name_array' => array(
'id' => 'account_id',
'name' => 'account_name',
),
);
$json = getJSONobj();
$encoded_popup_request_data = $json->encode($popup_request_data);
//
///////////////////////////////////////
$the_form .= <<${lbl_required_symbol}
EOQ;
}
$the_form .= <<$lbl_required_symbol
$ntc_date_format
$lbl_sales_stage $lbl_required_symbol