diff --git a/htdocs/langs/en_US/paybox.lang b/htdocs/langs/en_US/paybox.lang
index 2c5f3113b89..75dc26fa426 100644
--- a/htdocs/langs/en_US/paybox.lang
+++ b/htdocs/langs/en_US/paybox.lang
@@ -24,3 +24,7 @@ YouCanAddTagOnUrl=You can also add url parameter &tag=value to any
SetupPayBoxToHavePaymentCreatedAutomatically=Setup your PayBox with url %s to have payment created automatically when validated by paybox.
YourPaymentHasBeenRecorded=This page confirms that your payment has been recorded. Thank you.
YourPaymentHasNotBeenRecorded=You payment has not been recorded and transaction has been canceled. Thank you.
+AccountParameter=Account parameters
+UsageParameter=Usage parameters
+InformationToFindParameters=Help to find your %s account information
+
diff --git a/htdocs/langs/en_US/paypal.lang b/htdocs/langs/en_US/paypal.lang
index 3851ec9b1b1..8e20415bb38 100644
--- a/htdocs/langs/en_US/paypal.lang
+++ b/htdocs/langs/en_US/paypal.lang
@@ -1,4 +1,13 @@
-# Dolibarr language file - en_US - paypal
-CHARSET=UTF-8
-PaypalSetup=PayPal module setup
-PaypalDesc=This module offer pages to allow payment on PayPal by customers. This can be used for a free payment or for a payment on a particular Dolibarr object (invoice, order, ...)
\ No newline at end of file
+# Dolibarr language file - en_US - paypal
+CHARSET=UTF-8
+PaypalSetup=PayPal module setup
+PaypalDesc=This module offer pages to allow payment on PayPal by customers. This can be used for a free payment or for a payment on a particular Dolibarr object (invoice, order, ...)
+PaypalOrCBDoPayment=Pay with credit card or Paypal
+PaypalDoPayment=Pay with Paypal
+PaypalCBDoPayment=Pay with credit card
+PAYPAL_API_SANDBOX=Mode test/sandbox
+PAYPAL_API_USER=API username
+PAYPAL_API_PASSWORD=API password
+PAYPAL_API_SIGNATURE=API signature
+PAYPAL_API_INTEGRAL_OR_PAYPALONLY=Offer payment "integral" (Credit card+Paypal) or "Paypal" only
+PAYPAL_CSS_URL=Optionnal Url of CSS style sheet on payment page
diff --git a/htdocs/langs/fr_FR/paybox.lang b/htdocs/langs/fr_FR/paybox.lang
index 7fd1b0979d3..7376fdb1efc 100644
--- a/htdocs/langs/fr_FR/paybox.lang
+++ b/htdocs/langs/fr_FR/paybox.lang
@@ -24,3 +24,6 @@ YouCanAddTagOnUrl=Vous pouvez de plus ajouter le paramètre url &tag=value
SetupPayBoxToHavePaymentCreatedAutomatically=Configurez votre url PayBox à %s pour avoir le paiement créé automatiquement si validé.
YourPaymentHasBeenRecorded=Cette page confirme que votre paiement a bien été enregistré. Merci.
YourPaymentHasNotBeenRecorded=Votre paiement n'a pas été enregistré et la transaction a été annulée. Merci.
+AccountParameter=Paramètres du compte
+UsageParameter=Paramètres d'utilisation
+InformationToFindParameters=Informations pour trouver vos paramètres de compte %s
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/paypal.lang b/htdocs/langs/fr_FR/paypal.lang
index 6d51fa7938c..75ea7640c83 100644
--- a/htdocs/langs/fr_FR/paypal.lang
+++ b/htdocs/langs/fr_FR/paypal.lang
@@ -1,4 +1,13 @@
-# Dolibarr language file - fr_FR - paypal
-CHARSET=UTF-8
-PaypalSetup=Configuration module PayPal
-PaypalDesc=Ce module permet d'offrir une page de paiement via le prestataire Paypal pour réaliser un paiement quelconque ou un paiement par rapport à un objet Dolibarr (factures, commande...)
+# Dolibarr language file - fr_FR - paypal
+CHARSET=UTF-8
+PaypalSetup=Configuration module PayPal
+PaypalDesc=Ce module permet d'offrir une page de paiement via le prestataire Paypal pour réaliser un paiement quelconque ou un paiement par rapport à un objet Dolibarr (factures, commande...)
+PaypalOrCBDoPayment=Poursuivre le paiement par carte ou par Paypal
+PaypalDoPayment=Poursuivre le paiement par Paypal
+PaypalCBDoPayment=Poursuivre le paiement par carte
+PAYPAL_API_SANDBOX=Mode test/bac à sable (sandbox)
+PAYPAL_API_USER=Nom utilisateur API
+PAYPAL_API_PASSWORD=Mot de passe utilisateur API
+PAYPAL_API_SIGNATURE=Signature API
+PAYPAL_API_INTEGRAL_OR_PAYPALONLY=Proposer le paiement intégral (Carte+Paypal) ou Paypal seul
+PAYPAL_CSS_URL=Url optionnelle de la feuille de style CSS de la page de paiement
diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php
index efb331ec4b6..65d890d7e49 100644
--- a/htdocs/paypal/admin/paypal.php
+++ b/htdocs/paypal/admin/paypal.php
@@ -38,14 +38,14 @@ if (!$user->admin)
if ($_POST["action"] == 'setvalue' && $user->admin)
{
- $result=dolibarr_set_const($db, "PAYPAL_CSS_URL",$_POST["PAYPAL_CSS_URL"],'chaine',0,'',$conf->entity);
-
$result=dolibarr_set_const($db, "PAYPAL_API_SANDBOX",$_POST["PAYPAL_API_SANDBOX"],'chaine',0,'',$conf->entity);
- $result=dolibarr_set_const($db, "PAYPAL_API_INTEGRAL_OR_PAYPALONLY",$_POST["PAYPAL_API_INTEGRAL_OR_PAYPALONLY"],'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "PAYPAL_API_USER",$_POST["PAYPAL_API_USER"],'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "PAYPAL_API_PASSWORD",$_POST["PAYPAL_API_PASSWORD"],'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "PAYPAL_API_SIGNATURE",$_POST["PAYPAL_API_SIGNATURE"],'chaine',0,'',$conf->entity);
+ $result=dolibarr_set_const($db, "PAYPAL_API_INTEGRAL_OR_PAYPALONLY",$_POST["PAYPAL_API_INTEGRAL_OR_PAYPALONLY"],'chaine',0,'',$conf->entity);
+ $result=dolibarr_set_const($db, "PAYPAL_CSS_URL",$_POST["PAYPAL_CSS_URL"],'chaine',0,'',$conf->entity);
+
if ($result >= 0)
{
$mesg='
\n";
+if ($conf->use_javascript_ajax)
+{
+ print "\n".'';
+}
if ($mesg) print '
'.$mesg;
@@ -85,52 +91,64 @@ print '';
print '
';
+// Help doc
+print ''.$langs->trans("InformationToFindParameters","Paypal").':
';
+if ($conf->use_javascript_ajax) print ''.$langs->trans("ClickHere").'...';
+
+print '
+1. Log in to your PayPal Premier or Business account.
+2. Click the Profile subtab located under the My Account heading.
+3. Click the API Access link under the Account Information header.
+4. Click the View API Certificate link in the right column.
+5. Click the Request API signature radio button on the Request API Credentials page.
+6. Complete the Request API Credential Request form by clicking the agreement checkbox and clicking Submit.
+7. Save the values for API Username, Password and Signature (make sure this long character signature is copied).
+8. Click the "Modify" button after copying your API Username, Password, and Signature.
+';
+print '
';
+
+// Url list
print ''.$langs->trans("FollowingUrlAreAvailableToMakePayments").':
';
// Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr'
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
diff --git a/htdocs/public/paybox/newpayment.php b/htdocs/public/paybox/newpayment.php
index 3d90b755558..5819b370554 100644
--- a/htdocs/public/paybox/newpayment.php
+++ b/htdocs/public/paybox/newpayment.php
@@ -44,22 +44,13 @@ $token = md5(uniqid(mt_rand(),TRUE)); // Genere un hash d'un nombre aleatoire
if (isset($_SESSION['newtoken'])) $_SESSION['token'] = $_SESSION['newtoken'];
$_SESSION['newtoken'] = $token;
-// Verification de la presence et de la validite du jeton
-if (isset($_POST['token']) && isset($_SESSION['token']))
-{
- if ($_POST['token'] != $_SESSION['token'])
- {
- unset($_POST);
- }
-}
-
$langs->load("main");
$langs->load("other");
-$langs->load("paybox");
$langs->load("dict");
$langs->load("bills");
$langs->load("companies");
$langs->load("errors");
+$langs->load("paybox");
// Input are:
// type ('invoice','order','contractline'),
@@ -70,26 +61,27 @@ $langs->load("errors");
if (empty($_REQUEST["currency"])) $currency=$conf->global->MAIN_MONNAIE;
else $currency=$_REQUEST["currency"];
-if (empty($_REQUEST["amount"]) && empty($_REQUEST["source"]))
+
+if (! GETPOST("action"))
{
- dol_print_error('','ErrorBadParameters');
- session_destroy();
- exit;
+ if (empty($_REQUEST["amount"]) && empty($_REQUEST["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");
+ exit;
+ }
+ if (! empty($REQUEST["source"]) && empty($_REQUEST["ref"]))
+ {
+ dol_print_error('',$langs->trans('ErrorBadParameters')." - ref");
+ exit;
+ }
}
-$amount=$_REQUEST["amount"];
-if (is_numeric($amount) && empty($_REQUEST["tag"]) && empty($_REQUEST["source"]))
-{
- dol_print_error('','ErrorBadParameters');
- session_destroy();
- exit;
-}
-if (! empty($REQUEST["source"]) && empty($_REQUEST["ref"]))
-{
- dol_print_error('','ErrorBadParameters');
- session_destroy();
- exit;
-}
-$suffix=$_REQUEST["suffix"];
+$suffix=GETPOST("suffix");
@@ -306,7 +298,9 @@ if ($_REQUEST["source"] == 'order')
$var=!$var;
print ' '."\n";
+ $email=$order->client->email;
+ $email=(GETPOST("EMAIL")?GETPOST("EMAIL"):(isValidEmail($email)?$email:''));
+ print ''.$langs->trans("YourEMail");
print ' ('.$langs->trans("ToComplete").')';
- print '