Add php files
This commit is contained in:
34
modules/EcmPrices/AddToPriceBook.php
Executable file
34
modules/EcmPrices/AddToPriceBook.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?
|
||||
$result = $GLOBALS['db']->query("select name,id from ecmproducts where deleted='0'");
|
||||
$ile=$result->num_rows;
|
||||
if(!$_REQUEST['pricebook_id'])$_REQUEST['pricebook_id']=$_SESSION['add_to_pricebook_id'];
|
||||
$arr=array();
|
||||
for($i=0;$i<$ile;$i++)
|
||||
{
|
||||
if($_REQUEST['check'][$i])$arr[]=$i;
|
||||
}
|
||||
|
||||
foreach($arr as $i)
|
||||
{
|
||||
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select remarks from ecmproduct_language where language='PL' and ecmproduct_id='".$_REQUEST['check'][$i]."'"));
|
||||
$remarks_pl=$rr['remarks'];
|
||||
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select remarks from ecmproduct_language where language='EN' and ecmproduct_id='".$_REQUEST['check'][$i]."'"));
|
||||
$remarks_en=$rr['remarks'];
|
||||
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select remarks from ecmproduct_language where language='DE' and ecmproduct_id='".$_REQUEST['check'][$i]."'"));
|
||||
$remarks_de=$rr['remarks'];
|
||||
|
||||
$w=$GLOBALS['db']->query("select id from ecmprices_ecmproducts where ecmprice_id='".$_REQUEST['pricebook_id']."' and deleted='0' and ecmproduct_id='".$_REQUEST['check'][$i]."'");
|
||||
$price=floatval(str_replace(",",".",$_REQUEST['list_price_'.$_REQUEST['check'][$i]]));
|
||||
if(mysql_num_rows($w)==0)
|
||||
{
|
||||
$GLOBALS['db']->query("insert into ecmprices_ecmproducts(id,ecmprice_id,ecmproduct_id,deleted,price,remarks_pl,remarks_en,remarks_de,created_by,date_entered,date_modified,modified_user_id) values('".create_guid()."','".$_REQUEST['pricebook_id']."','".$_REQUEST['check'][$i]."','0','".$price."','".$remarks_pl."','".$remarks_en."','".$remarks_de."','".$_SESSION['authenticated_user_id']."','".date("Y-m-d H:i:s")."','".date("Y-m-d H:i:s")."','".$_SESSION['authenticated_user_id']."')");
|
||||
}
|
||||
else
|
||||
{
|
||||
$z="update ecmprices_ecmproducts set price='".$price."' where ecmprice_id='".$_REQUEST['pricebook_id']."' and ecmproduct_id='".$_REQUEST['check'][$i]."'";
|
||||
$GLOBALS['db']->query($z);
|
||||
}
|
||||
}
|
||||
//print mysql_error();
|
||||
header("Location: index.php?module=EcmPrices&action=DetailView&record=".$_REQUEST['pricebook_id']."&tab=items");
|
||||
?>
|
||||
Reference in New Issue
Block a user