<?
if($_REQUEST['action']!="DeleteFromPriceBook" || !$_REQUEST['but'])die();
//echo $_REQUEST['return_id'];
//print_r($_SESSION['pricebook_check']);
/*
$sugarEntry=true;
global $db;
$GLOBALS['db']->query("update ecmpricekopias_ecmproducts set deleted='1' where ecmpricekopia_id='".$_REQUEST['pricebook_id']."' and ecmproduct_id='".$_REQUEST['record']."'");
$_REQUEST['customview_id']=$_COOKIE['customview_id'];
include("modules/EcmPriceKopias/ListViewProductsAjax.php");*/
$input=array();
if(count($_SESSION['pricebook_check'][$_REQUEST['return_id']])>0)
{
	foreach($_SESSION['pricebook_check'][$_REQUEST['return_id']] as $key=>$value)
	{
		if($_SESSION['pricebook_check'][$_REQUEST['return_id']][$key]=="true")
		{
			//$GLOBALS['db']->query("update ecmpricekopias_ecmproducts set date_modified='".date("Y-m-d H:i:s")."',modified_user_id='".$_SESSION['authenticated_user_id']."',deleted='1' where id='".$key."' and ecmpricekopia_id='".$_REQUEST['return_id']."'");
			$input[]=$key;
		}
	}
}
//print mysql_error();
if(count($input)>0){
	echo '<form action="index.php?module=EcmPriceKopias&action=deleteProducts" method="post"><input type="hidden" value="'.implode("|",$input).'" name="keys"><input type="hidden" value="'.$_REQUEST['return_id'].'" name="return_id">Following products will be deleted:<br>';
	foreach($input as $in){
		$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select p.name,p.code from ecmproducts as p inner join ecmpricekopias_ecmproducts as e on e.ecmproduct_id=p.id where e.id='".$in."'"));
		echo $r['coce']." ".$r['name']."<br>";
	}
	echo '<br><input type="submit" name="del" value="Confirm"></form>';
}

?>