Files
crm.e5.pl/modules/EcmPriceBooks/DeleteFromPriceBook.php
2024-04-27 09:23:34 +02:00

33 lines
1.6 KiB
PHP
Executable File

<?
if($_REQUEST['action']!="DeleteFromPriceBook" || !$_REQUEST['but'])die();
//echo $_REQUEST['return_id'];
//print_r($_SESSION['pricebook_check']);
/*
$sugarEntry=true;
global $db;
$GLOBALS['db']->query("update ecmpricebooks_ecmproducts set deleted='1' where ecmpricebook_id='".$_REQUEST['pricebook_id']."' and ecmproduct_id='".$_REQUEST['record']."'");
$_REQUEST['customview_id']=$_COOKIE['customview_id'];
include("modules/EcmPriceBooks/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 ecmpricebooks_ecmproducts set date_modified='".date("Y-m-d H:i:s")."',modified_user_id='".$_SESSION['authenticated_user_id']."',deleted='1' where id='".$key."' and ecmpricebook_id='".$_REQUEST['return_id']."'");
$input[]=$key;
}
}
}
//print mysql_error();
if(count($input)>0){
echo '<form action="index.php?module=EcmPriceBooks&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 ecmpricebooks_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>';
}
?>