Add php files
This commit is contained in:
27
import/EcmPriceBooks/SavePrices.php
Normal file
27
import/EcmPriceBooks/SavePrices.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?
|
||||
$sugarEntry=true;
|
||||
global $db;
|
||||
function priceToDb($v){
|
||||
$v=str_replace(".","",$v);
|
||||
$v=str_replace(",",".",$v);
|
||||
return floatval($v);
|
||||
}
|
||||
for($i=1;$i<=1000;$i++){
|
||||
if (!$_REQUEST['product_id_'.$i]) continue;
|
||||
$prod = $_REQUEST['product_id_'.$i];
|
||||
if($_REQUEST['product_id_'.$i]){
|
||||
$rp=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select ecmproduct_id,price from ecmpricebooks_ecmproducts where id='".$_REQUEST['product_id_'.$i]."' and deleted='0'"));
|
||||
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select vat_value from ecmproducts where id='".$rp['ecmproduct_id']."'"));
|
||||
$price=priceToDb($_REQUEST['price_brutto_'.$i])/(1+$r['vat_value']/100);
|
||||
if($rp['price']!=priceToDb($_REQUEST['price_'.$i]) || $_REQUEST['price_'.$i]=="")$price=priceToDb($_REQUEST['price_'.$i]);
|
||||
$GLOBALS['db']->query("update ecmpricebooks_ecmproducts set popular='".$_REQUEST['popular_'.$i]."',recipient_code='".$_REQUEST['recipient_code_'.$i]."',remarks_pl='".$_REQUEST['remarks_pl_'.$i]."',remarks_en='".$_REQUEST['remarks_en_'.$i]."',remarks_de='".$_REQUEST['remarks_de_'.$i]."',price='".$price."' where id='".$_REQUEST['product_id_'.$i]."'");
|
||||
$_SESSION['EcmPriceBooks_high'][$_REQUEST['product_id_'.$i]]=true;
|
||||
}
|
||||
}
|
||||
$_REQUEST['customview_id']=$_COOKIE['customview_id'];
|
||||
$_GET['customview_id']=$_COOKIE['customview_id'];
|
||||
|
||||
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select ecmpricebook_id from ecmpricebooks_ecmproducts where id='".$prod."'"));
|
||||
|
||||
header("Location: index.php?module=EcmPriceBooks&action=DetailView&record=".$r['ecmpricebook_id']."&tab=items");
|
||||
?>
|
||||
Reference in New Issue
Block a user