diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index c7753cf298d..d7be10b9033 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -786,6 +786,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
$vat_rate=str_replace('*','',$vat_rate);
$localtax1_rate=get_localtax($vat_rate,1,$object->client);
$localtax2_rate=get_localtax($vat_rate,2,$object->client);
+ $up_ht=GETPOST('pu')?GETPOST('pu'):GETPOST('subprice');
// On verifie que le prix minimum est respecte
$productid = $_POST['productid'] ;
@@ -794,21 +795,21 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
$product = new Product($db) ;
$res=$product->fetch($productid) ;
}
- if ($productid && $product->price_min && ( price2num($_POST['subprice'])*(1-price2num($_POST['remise_percent'])/100) < price2num($product->price_min)))
+ if ($productid && $product->price_min && (price2num($up_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($product->price_min)))
{
$mesg = '
'.$langs->trans("CantBeLessThanMinPrice",price2num($product->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
' ;
}
else
{
$result = $object->updateline($_POST['lineid'],
- $_POST['subprice'],
+ $up_ht,
$_POST['qty'],
$_POST['remise_percent'],
$vat_rate,
$localtax1_rate,
$localtax2_rate,
$_POST['desc'],
- 'HT',
+ 'HT',
$info_bits);
// Define output language
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 7a3151154c1..88ce0ef4c69 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -452,7 +452,8 @@ if ($_POST['action'] == 'addline' && $user->rights->commande->creer)
{
if($prod->price_min && (price2num($pu_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($prod->price_min)))
{
- $mesg = ''.$langs->trans("CantBeLessThanMinPrice",price2num($prod->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
' ;
+ //print "CantBeLessThanMinPrice ".$up_ht." - ".GETPOST('remise_percent')." - ".$product->price_min;
+ $mesg = ''.$langs->trans("CantBeLessThanMinPrice",price2num($prod->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
' ;
}
else
{
@@ -522,6 +523,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
$date_start=dol_mktime(0, 0, 0, $_POST['date_start'.$suffixe.'month'], $_POST['date_start'.$suffixe.'day'], $_POST['date_start'.$suffixe.'year']);
$date_end=dol_mktime(0, 0, 0, $_POST['date_end'.$suffixe.'month'], $_POST['date_end'.$suffixe.'day'], $_POST['date_end'.$suffixe.'year']);
$description=dol_htmlcleanlastbr($_POST['desc']);
+ $up_ht=GETPOST('pu')?GETPOST('pu'):GETPOST('subprice');
// Define info_bits
$info_bits=0;
@@ -547,7 +549,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
$product->fetch($productid);
$type=$product->type;
}
- if ($product->price_min && ($_POST['productid']!='') && ( price2num($_POST['pu'])*(1-price2num($_POST['elremise_percent'])/100) < price2num($product->price_min)))
+ if ($product->price_min && GETPOST('productid') && (price2num($up_ht)*(1-price2num($_POST['elremise_percent'])/100) < price2num($product->price_min)))
{
$mesg = ''.$langs->trans("CantBeLessThanMinPrice",price2num($product->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
' ;
$result=-1;
@@ -567,7 +569,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
{
$result = $object->updateline($_POST['lineid'],
$description,
- $_POST['pu'],
+ $up_ht,
$_POST['qty'],
$_POST['elremise_percent'],
$vat_rate,
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 0182fc729d6..05b97cddc32 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -963,6 +963,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST
$date_start=dol_mktime($_POST['date_start'.$suffixe.'hour'],$_POST['date_start'.$suffixe.'min'],$_POST['date_start'.$suffixe.'sec'],$_POST['date_start'.$suffixe.'month'],$_POST['date_start'.$suffixe.'day'],$_POST['date_start'.$suffixe.'year']);
$date_end=dol_mktime($_POST['date_end'.$suffixe.'hour'],$_POST['date_end'.$suffixe.'min'],$_POST['date_end'.$suffixe.'sec'],$_POST['date_end'.$suffixe.'month'],$_POST['date_end'.$suffixe.'day'],$_POST['date_end'.$suffixe.'year']);
$description=dol_htmlcleanlastbr($_POST['desc']);
+ $up_ht=GETPOST('pu')?GETPOST('pu'):GETPOST('subprice');
// Define info_bits
$info_bits=0;
@@ -988,9 +989,9 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST
$product->fetch($productid);
$type=$product->type;
}
- if ($product->price_min && GETPOST('productid') && (price2num(GETPOST('subprice'))*(1-price2num(GETPOST('remise_percent'))/100) < price2num($product->price_min)))
+ if ($product->price_min && GETPOST('productid') && (price2num($up_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($product->price_min)))
{
- print "CantBeLessThanMinPrice ".GETPOST('subprice')." - ".GETPOST('remise_percent')." - ".$product->price_min;
+ //print "CantBeLessThanMinPrice ".$up_ht." - ".GETPOST('remise_percent')." - ".$product->price_min;
$mesg = ''.$langs->trans("CantBeLessThanMinPrice",price2num($product->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
';
$result=-1;
}
@@ -1004,7 +1005,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST
{
$result = $object->updateline(GETPOST('lineid'),
$description,
- GETPOST('subprice'),
+ $up_ht,
GETPOST('qty'),
GETPOST('remise_percent'),
$date_start,
diff --git a/htdocs/public/paybox/newpayment.php b/htdocs/public/paybox/newpayment.php
index 5819b370554..3633de1fb2f 100644
--- a/htdocs/public/paybox/newpayment.php
+++ b/htdocs/public/paybox/newpayment.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2006-2009 Laurent Destailleur
+ * Copyright (C) 2006-2010 Laurent Destailleur
* Copyright (C) 2009 Regis Houssin
*
* This program is free software; you can redistribute it and/or modify
@@ -59,17 +59,18 @@ $langs->load("paybox");
// tag (a free text, required if type is empty)
// currency (iso code)
-if (empty($_REQUEST["currency"])) $currency=$conf->global->MAIN_MONNAIE;
-else $currency=$_REQUEST["currency"];
+$suffix=GETPOST("suffix");
+$amount=GETPOST("amount");
+if (! GETPOST("currency")) $currency=$conf->global->MAIN_MONNAIE;
+else $currency=GETPOST("currency");
if (! GETPOST("action"))
{
- if (empty($_REQUEST["amount"]) && empty($_REQUEST["source"]))
+ if (! GETPOST("amount") && ! GETPOST("source"))
{
dol_print_error('',$langs->trans('ErrorBadParameters')." - amount or source");
exit;
}
- $amount=$_REQUEST["amount"];
if (is_numeric($amount) && empty($_REQUEST["tag"]) && empty($_REQUEST["source"]))
{
dol_print_error('',$langs->trans('ErrorBadParameters')." - tag or source");
@@ -81,8 +82,24 @@ if (! GETPOST("action"))
exit;
}
}
-$suffix=GETPOST("suffix");
+$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
+$urlok=$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/paymentok.php?';
+$urlko=$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/paymentko.php?';
+
+$TAG=GETPOST("tag");
+$FULLTAG=GETPOST("fulltag"); // fulltag is tag with more informations
+
+if (!empty($TAG))
+{
+ $urlok.='tag='.$TAG.'&';
+ $urlko.='tag='.$TAG.'&';
+}
+if (!empty($FULLTAG))
+{
+ $urlok.='fulltag='.$FULLTAG.'&';
+ $urlko.='fulltag='.$FULLTAG.'&';
+}
/*
@@ -90,24 +107,22 @@ $suffix=GETPOST("suffix");
*/
if ($_REQUEST["action"] == 'dopayment')
{
- $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
-
- $PRICE=$_REQUEST["newamount"];
- $EMAIL=$_REQUEST["EMAIL"];
- $urlok=$urlwithouturlroot.DOL_URL_ROOT.'/public/paybox/paymentok.php';
- $urlko=$urlwithouturlroot.DOL_URL_ROOT.'/public/paybox/paymentko.php';
- $TAG=$_REQUEST["newtag"];
- $ID=$_REQUEST["id"];
+ $PAYPAL_API_PRICE=price2num(GETPOST("newamount"));
+ $EMAIL=GETPOST("EMAIL");
+ $ID=GETPOST("id");
$mesg='';
if (empty($PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount"));
elseif (empty($EMAIL)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail"));
elseif (! isValidEMail($EMAIL)) $mesg=$langs->trans("ErrorBadEMail",$EMAIL);
- elseif (empty($TAG)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode"));
+ elseif (empty($FULLTAG)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode"));
if (empty($mesg))
{
+ dol_syslog("newpayment.php call paybox api and do redirect", LOG_DEBUG);
+
print_paybox_redirect($PRICE, $conf->monnaie, $EMAIL, $urlok, $urlko, $TAG, $ID);
+
session_destroy();
exit;
}
@@ -128,16 +143,22 @@ $paramcreditor='PAYBOX_CREDITOR_'.$suffix;
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
else if (! empty($conf->global->PAYBOX_CREDITOR)) $creditor=$conf->global->PAYBOX_CREDITOR;
+print ''."\n";
print '';
-print '';
-print '';
+print ''."\n";
+print ''."\n";
+print ''."\n";
print '
';
diff --git a/htdocs/public/paypal/expresscheckout.php b/htdocs/public/paypal/expresscheckout.php
index cb8b23e7c6a..ab36aae7808 100755
--- a/htdocs/public/paypal/expresscheckout.php
+++ b/htdocs/public/paypal/expresscheckout.php
@@ -77,19 +77,10 @@ if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'paypalonly')
// For payment with Credit card or Paypal
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'integral')
{
- $shipToName=GETPOST("shipToName");
- $shipToStreet=GETPOST("shipToStreet");
- $shipToCity=GETPOST("shipToCity");
- $shipToState=GETPOST("shipToState");
- $shipToCountryCode=GETPOST("shipToCountryCode");
- $shipToZip=GETPOST("shipToZip");
- $shipToStreet2=GETPOST("shipToStreet2");
- $phoneNum=GETPOST("phoneNum");
-
dol_syslog("expresscheckout redirect with CallMarkExpressCheckout $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum");
- //$resArray = CallMarkExpressCheckout ($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL);
- $resArray = CallMarkExpressCheckout ($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL,
- $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum);
+ $resArray = CallMarkExpressCheckout ($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL);
+ //$resArray = CallMarkExpressCheckout ($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL,
+ //$shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum);
}
// For direct payment with credit card
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'cconly')
diff --git a/htdocs/public/paypal/newpayment.php b/htdocs/public/paypal/newpayment.php
index 73fa011e9f5..6b98977a9e3 100755
--- a/htdocs/public/paypal/newpayment.php
+++ b/htdocs/public/paypal/newpayment.php
@@ -60,17 +60,18 @@ $langs->load("paypal");
// tag (a free text, required if type is empty)
// currency (iso code)
-if (empty($_REQUEST["currency"])) $currency=$conf->global->MAIN_MONNAIE;
-else $currency=$_REQUEST["currency"];
+$suffix=GETPOST("suffix");
+$amount=GETPOST("amount");
+if (! GETPOST("currency")) $currency=$conf->global->MAIN_MONNAIE;
+else $currency=GETPOST("currency");
if (! GETPOST("action"))
{
- if (empty($_REQUEST["amount"]) && empty($_REQUEST["source"]))
+ if (! GETPOST("amount") && ! GETPOST("source"))
{
dol_print_error('',$langs->trans('ErrorBadParameters')." - amount or source");
exit;
}
- $amount=$_REQUEST["amount"];
if (is_numeric($amount) && empty($_REQUEST["tag"]) && empty($_REQUEST["source"]))
{
dol_print_error('',$langs->trans('ErrorBadParameters')." - tag or source");
@@ -82,7 +83,6 @@ if (! GETPOST("action"))
exit;
}
}
-$suffix=GETPOST("suffix");
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
$urlok=$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/paymentok.php?';
@@ -109,10 +109,19 @@ if (!empty($FULLTAG))
*/
if (GETPOST("action") == 'dopayment')
{
- $PAYPAL_API_PRICE=GETPOST("newamount");
+ $PAYPAL_API_PRICE=price2num(GETPOST("newamount"));
$EMAIL=GETPOST("EMAIL");
$ID=GETPOST("id");
+ $shipToName=GETPOST("shipToName");
+ $shipToStreet=GETPOST("shipToStreet");
+ $shipToCity=GETPOST("shipToCity");
+ $shipToState=GETPOST("shipToState");
+ $shipToCountryCode=GETPOST("shipToCountryCode");
+ $shipToZip=GETPOST("shipToZip");
+ $shipToStreet2=GETPOST("shipToStreet2");
+ $phoneNum=GETPOST("phoneNum");
+
$mesg='';
if (empty($PAYPAL_API_PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount"));
elseif (empty($EMAIL)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail"));
@@ -122,16 +131,6 @@ if (GETPOST("action") == 'dopayment')
//var_dump($_POST);
if (empty($mesg))
{
- /*
- print_paypal_redirect($PAYPAL_API_PRICE, $conf->monnaie, $EMAIL, $urlok, $urlko, $TAG, $ID);
- exit;
-
- global $conf, $langs, $db;
- global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE;
- global $PAYPAL_API_DEVISE, $PAYPAL_API_OK, $PAYPAL_API_KO;
- global $PAYPAL_API_SANDBOX;
- */
-
dol_syslog("newpayment.php call paypal api and do redirect", LOG_DEBUG);
// Clean parameters
@@ -169,7 +168,7 @@ if (GETPOST("action") == 'dopayment')
if ($CURRENCY == 'EUR') $PAYPAL_API_DEVISE="EUR";
if ($CURRENCY == 'USD') $PAYPAL_API_DEVISE="USD";
- dol_syslog("Soumission Paypal", LOG_DEBUG);
+ dol_syslog("Submit Paypal form", LOG_DEBUG);
dol_syslog("PAYPAL_API_USER: $PAYPAL_API_USER", LOG_DEBUG);
//dol_syslog("PAYPAL_API_PASSWORD: $PAYPAL_API_PASSWORD", LOG_DEBUG); // No password into log files
dol_syslog("PAYPAL_API_SIGNATURE: $PAYPAL_API_SIGNATURE", LOG_DEBUG);
@@ -178,6 +177,14 @@ if (GETPOST("action") == 'dopayment')
dol_syslog("PAYPAL_API_KO: $PAYPAL_API_KO", LOG_DEBUG);
dol_syslog("PAYPAL_API_PRICE: $PAYPAL_API_PRICE", LOG_DEBUG);
dol_syslog("PAYPAL_API_DEVISE: $PAYPAL_API_DEVISE", LOG_DEBUG);
+ dol_syslog("shipToName: $shipToName", LOG_DEBUG);
+ dol_syslog("shipToStreet: $shipToStreet", LOG_DEBUG);
+ dol_syslog("shipToCity: $shipToCity", LOG_DEBUG);
+ dol_syslog("shipToState: $shipToState", LOG_DEBUG);
+ dol_syslog("shipToCountryCode: $shipToCountryCode", LOG_DEBUG);
+ dol_syslog("shipToZip: $shipToZip", LOG_DEBUG);
+ dol_syslog("shipToStreet2: $shipToStreet2", LOG_DEBUG);
+ dol_syslog("phoneNum: $phoneNum", LOG_DEBUG);
header("Content-type: text/html; charset=".$conf->file->character_set_client);
@@ -193,27 +200,9 @@ if (GETPOST("action") == 'dopayment')
// A redirect is added if API call successfull
require_once(DOL_DOCUMENT_ROOT."/public/paypal/expresscheckout.php");
- // Formulaire pour module Paybox
- // print '";
- // print ''."\n";
-
- // print "\n";
- // print ''."\n";
- // print "\n";
-
-
print '