fetech the values from one module to another module manually (writing a code)

I’m trying to capture Lead module vales to Opportunity module value when we convert the lead.
But am Getting blank values in opportunity modules.
blank value is displaying in opportunity module.

my code is below

require_once(‘modules/Leads/Lead.php’);
require_once(‘modules/ST_ProductLines/ST_ProductLines.php’);
require_once(‘include/formbase.php’);
global $current_user;
$focus = new Opportunity();
//print_r($_POST);
//echo “
”;echo “
”;
//die();
$focus->retrieve($_POST[‘record’]);
if(!$focus->ACLAccess(‘Save’)){
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
if (!empty($_POST[‘assigned_user_id’]) && ($focus->assigned_user_id != $_POST[‘assigned_user_id’]) && ($_POST[‘assigned_user_id’] != $current_user->id)) {
$check_notify = TRUE;
}else{
$check_notify = FALSE;
}

foreach($focus->column_fields as $field){
if(isset($_POST[$field])){
$value = $_POST[$field];
$focus->$field = $value;
}
}

foreach($focus->additional_column_fields as $field){
if(isset($_POST[$field])){
$value = $_POST[$field];
$focus->$field = $value;
}
}

//print_r($_REQUEST);
//die();
if(empty($_POST[‘assigned_user_id’])){
$focus->assigned_user_id = $current_user->id;
}

$focus->last_name = $_POST[‘last_name’];
//echo “am here”.$_POST[‘last_name’];

$focus->unformat_all_fields();
$focus->save($check_notify);
$return_id = $focus->id;

echo $focus->st_lead_next_step;

/Start Product Lines Saving***************************/

$st_productlines = new ST_ProductLines();
$st_productlines->mark_deletedByProductId($return_id);
$product_count = ‘’;
$product_count = $_POST[“product_count”];

for($j=1; $j<=$product_count; $j++) {

$GLOBALS['log']->debug("adding the first row".$i);

$index = $j;

$product_name					= $_POST['product_name_'.$index];

$product_id						= $_POST["product_id_".$index];	
	
if ($product_id == ''){
	continue;
}
else {	

$st_productlines 				= new ST_ProductLines();
$st_productlines->reference_id	= $return_id;
$st_productlines->product_id	= $product_id;
$st_productlines->name			= $product_name;			
$st_productlines->save($check_notify);


}

}//end of else
/Endo of Product Line Saving***************/

if($focus->st_lead_next_step==‘Opportunity’){
require_once(‘modules/Opportunities/Opportunity.php’);
$opportunity = new Opportunity();
$opportunity->assigned_end_client_contact_name = $focus->last_name;
$opportunity->account_name = $focus->account_name;
$opportunity->name = $focus->st_project_name;

$opportunity->st_opp_no = $opportunity->opp_number_generation();
$opportunity->assigned_user_id = $current_user->id;
$opportunity_id = $opportunity->save('', true, false);

//}
//print_r($opportunity->opp_number_generation());
//break;


if($lead_id !=""){  // Start of If

	$product_lines_for_leads = $focus->getProductsDetails($return_id);
	
	$count_product_lines = count($product_lines_for_leads);
	echo "The count is ".$count_product_lines;
	require_once('modules/Leads_AOS_Products/Leads_AOS_Products.php');

	for ($i=0 ; $i<$count_product_lines; $i++){// Start of Loop
		
		$lap = new Leads_AOS_Products();
		$lap->name		= $product_lines_for_leads[$i]['name'];
		$lap->lead_id		= $lead_id;
		$lap->product_id	= $product_lines_for_leads[$i]['product_id'];
		$lap->save($check_notify);
	}// End of Loop
} // End of IF

}

/*********************************************************************************

  • Description: TODO: To be written.
  • Portions created by SugarCRM are Copyright © SugarCRM, Inc.
  • All Rights Reserved.
  • Contributor(s): ______________________________________

    ********************************************************************************/

require_once(‘modules/Leads/LeadFormBase.php’);
$leadForm = new LeadFormBase();
$leadForm->handleSave(’’, true, false);

help me