Work on paypal module
This commit is contained in:
parent
a58ae14d8f
commit
d7ee5ee5ac
@ -24,3 +24,7 @@ YouCanAddTagOnUrl=You can also add url parameter <b>&tag=<i>value</i></b> to any
|
|||||||
SetupPayBoxToHavePaymentCreatedAutomatically=Setup your PayBox with url <b>%s</b> to have payment created automatically when validated by paybox.
|
SetupPayBoxToHavePaymentCreatedAutomatically=Setup your PayBox with url <b>%s</b> to have payment created automatically when validated by paybox.
|
||||||
YourPaymentHasBeenRecorded=This page confirms that your payment has been recorded. Thank you.
|
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.
|
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
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,13 @@
|
|||||||
# Dolibarr language file - en_US - paypal
|
# Dolibarr language file - en_US - paypal
|
||||||
CHARSET=UTF-8
|
CHARSET=UTF-8
|
||||||
PaypalSetup=PayPal module setup
|
PaypalSetup=PayPal module setup
|
||||||
PaypalDesc=This module offer pages to allow payment on <a href="http://www.paypal.com" target="_blank">PayPal</a> by customers. This can be used for a free payment or for a payment on a particular Dolibarr object (invoice, order, ...)
|
PaypalDesc=This module offer pages to allow payment on <a href="http://www.paypal.com" target="_blank">PayPal</a> 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
|
||||||
|
|||||||
@ -24,3 +24,6 @@ YouCanAddTagOnUrl=Vous pouvez de plus ajouter le paramètre url <b>&tag=<i>value
|
|||||||
SetupPayBoxToHavePaymentCreatedAutomatically=Configurez votre url PayBox à <b>%s</b> pour avoir le paiement créé automatiquement si validé.
|
SetupPayBoxToHavePaymentCreatedAutomatically=Configurez votre url PayBox à <b>%s</b> pour avoir le paiement créé automatiquement si validé.
|
||||||
YourPaymentHasBeenRecorded=Cette page confirme que votre paiement a bien été enregistré. Merci.
|
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.
|
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
|
||||||
@ -1,4 +1,13 @@
|
|||||||
# Dolibarr language file - fr_FR - paypal
|
# Dolibarr language file - fr_FR - paypal
|
||||||
CHARSET=UTF-8
|
CHARSET=UTF-8
|
||||||
PaypalSetup=Configuration module PayPal
|
PaypalSetup=Configuration module PayPal
|
||||||
PaypalDesc=Ce module permet d'offrir une page de paiement via le prestataire <a href="http://www.paypal.com" target="_blank">Paypal</a> pour réaliser un paiement quelconque ou un paiement par rapport à un objet Dolibarr (factures, commande...)
|
PaypalDesc=Ce module permet d'offrir une page de paiement via le prestataire <a href="http://www.paypal.com" target="_blank">Paypal</a> 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
|
||||||
|
|||||||
@ -38,14 +38,14 @@ if (!$user->admin)
|
|||||||
|
|
||||||
if ($_POST["action"] == 'setvalue' && $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_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_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_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_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)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
$mesg='<div class="ok">'.$langs->trans("SetupSaved").'</div>';
|
$mesg='<div class="ok">'.$langs->trans("SetupSaved").'</div>';
|
||||||
@ -63,20 +63,26 @@ if ($_POST["action"] == 'setvalue' && $user->admin)
|
|||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|
||||||
$IBS_SITE="1999888"; # Site test
|
|
||||||
if (empty($conf->global->PAYPAL_IBS_SITE)) $conf->global->PAYPAL_IBS_SITE=$IBS_SITE;
|
|
||||||
$IBS_RANG="99"; # Rang test
|
|
||||||
if (empty($conf->global->PAYPAL_IBS_RANG)) $conf->global->PAYPAL_IBS_RANG=$IBS_RANG;
|
|
||||||
$IBS_DEVISE="978"; # Euro
|
|
||||||
if (empty($conf->global->PAYPAL_IBS_DEVISE)) $conf->global->PAYPAL_IBS_DEVISE=$IBS_DEVISE;
|
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
|
|
||||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
print_fiche_titre($langs->trans("PaypalSetup"),$linkback,'setup');
|
print_fiche_titre($langs->trans("PaypalSetup"),$linkback,'setup');
|
||||||
|
|
||||||
print $langs->trans("PaypalDesc")."<br>\n";
|
print $langs->trans("PaypalDesc")."<br>\n";
|
||||||
|
|
||||||
|
if ($conf->use_javascript_ajax)
|
||||||
|
{
|
||||||
|
print "\n".'<script type="text/javascript" language="javascript">';
|
||||||
|
print 'jQuery(document).ready(function () {
|
||||||
|
jQuery("#apidoc").hide();
|
||||||
|
jQuery("#apidoca").click(function() {
|
||||||
|
jQuery("#apidoca").hide();
|
||||||
|
jQuery("#apidoc").show();
|
||||||
|
});
|
||||||
|
});';
|
||||||
|
print '</script>';
|
||||||
|
}
|
||||||
|
|
||||||
if ($mesg) print '<br>'.$mesg;
|
if ($mesg) print '<br>'.$mesg;
|
||||||
|
|
||||||
@ -85,52 +91,64 @@ print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
|||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="setvalue">';
|
print '<input type="hidden" name="action" value="setvalue">';
|
||||||
|
|
||||||
$var=true;
|
|
||||||
|
|
||||||
print '<table class="nobordernopadding" width="100%">';
|
print '<table class="nobordernopadding" width="100%">';
|
||||||
|
|
||||||
|
$var=true;
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
print '<td width="30%">'.$langs->trans("AccountParameter").'</td>';
|
||||||
print '<td>'.$langs->trans("Value").'</td>';
|
print '<td>'.$langs->trans("Value").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$var=!$var;
|
|
||||||
print '<tr '.$bc[$var].'><td>';
|
|
||||||
print '<span class="fieldrequired">'.$langs->trans("PAYPAL_API_USER").'</span></td><td>';
|
|
||||||
print '<input size="32" type="text" name="PAYPAL_API_USER" value="'.$conf->global->PAYPAL_API_USER.'">';
|
|
||||||
print '<br>'.$langs->trans("Example").': paypal_api1.mywebsite.com';
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
$var=!$var;
|
|
||||||
print '<tr '.$bc[$var].'><td>';
|
|
||||||
print '<span class="fieldrequired">'.$langs->trans("PAYPAL_API_PASSWORD").'</span></td><td>';
|
|
||||||
print '<input size="32" type="text" name="PAYPAL_API_PASSWORD" value="'.$conf->global->PAYPAL_API_PASSWORD.'">';
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
$var=!$var;
|
|
||||||
print '<tr '.$bc[$var].'><td>';
|
|
||||||
print '<span class="fieldrequired">'.$langs->trans("PAYPAL_API_SIGNATURE").'</span></td><td>';
|
|
||||||
print '<input size="64" type="text" name="PAYPAL_API_SIGNATURE" value="'.$conf->global->PAYPAL_API_SIGNATURE.'">';
|
|
||||||
print '<br>'.$langs->trans("Example").': ASsqXEmw4KzmX-CPChWSVDNCNfd.A3YNR7uz-VncXXAERFDFDFDF';
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
$var=!$var;
|
|
||||||
print '<tr '.$bc[$var].'><td>';
|
|
||||||
print '<span class="fieldrequired">'.$langs->trans("PAYPAL_API_INTEGRAL_OR_PAYPALONLY").'</span></td><td>';
|
|
||||||
print $form->selectarray("PAYPAL_API_INTEGRAL_OR_PAYPALONLY",array('integral'=>'Integral','paypalonly'=>'Paypal only'),$conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
$var=!$var;
|
|
||||||
print '<tr '.$bc[$var].'><td>';
|
|
||||||
print '<span class="fieldrequired">'.$langs->trans("PAYPAL_API_EXPRESS").'</span></td><td>';
|
|
||||||
print $form->selectyesno("PAYPAL_API_EXPRESS",$conf->global->PAYPAL_API_EXPRESS);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td>';
|
print '<tr '.$bc[$var].'><td>';
|
||||||
print $langs->trans("PAYPAL_API_SANDBOX").'</td><td>';
|
print $langs->trans("PAYPAL_API_SANDBOX").'</td><td>';
|
||||||
print $form->selectyesno("PAYPAL_API_SANDBOX",$conf->global->PAYPAL_API_SANDBOX);
|
print $form->selectyesno("PAYPAL_API_SANDBOX",$conf->global->PAYPAL_API_SANDBOX);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'><td>';
|
||||||
|
print $langs->trans("PAYPAL_API_USER").'</td><td>';
|
||||||
|
print '<input size="32" type="text" name="PAYPAL_API_USER" value="'.$conf->global->PAYPAL_API_USER.'">';
|
||||||
|
print '<br>'.$langs->trans("Example").': paypal_api1.mywebsite.com';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'><td>';
|
||||||
|
print $langs->trans("PAYPAL_API_PASSWORD").'</td><td>';
|
||||||
|
print '<input size="32" type="text" name="PAYPAL_API_PASSWORD" value="'.$conf->global->PAYPAL_API_PASSWORD.'">';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'><td>';
|
||||||
|
print $langs->trans("PAYPAL_API_SIGNATURE").'</td><td>';
|
||||||
|
print '<input size="64" type="text" name="PAYPAL_API_SIGNATURE" value="'.$conf->global->PAYPAL_API_SIGNATURE.'">';
|
||||||
|
print '<br>'.$langs->trans("Example").': ASsqXEmw4KzmX-CPChWSVDNCNfd.A3YNR7uz-VncXXAERFDFDFDF';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '<table class="nobordernopadding" width="100%">';
|
||||||
|
|
||||||
|
$var=true;
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td width="30%">'.$langs->trans("UsageParameter").'</td>';
|
||||||
|
print '<td>'.$langs->trans("Value").'</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'><td>';
|
||||||
|
print $langs->trans("PAYPAL_API_INTEGRAL_OR_PAYPALONLY").'</td><td>';
|
||||||
|
print $form->selectarray("PAYPAL_API_INTEGRAL_OR_PAYPALONLY",array('integral'=>'Integral','paypalonly'=>'Paypal only'),$conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
/*$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'><td>';
|
||||||
|
print '<span class="fieldrequired">'.$langs->trans("PAYPAL_API_EXPRESS").'</span></td><td>';
|
||||||
|
print $form->selectyesno("PAYPAL_API_EXPRESS",$conf->global->PAYPAL_API_EXPRESS);
|
||||||
|
print '</td></tr>';
|
||||||
|
*/
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td>';
|
print '<tr '.$bc[$var].'><td>';
|
||||||
print $langs->trans("PAYPAL_CSS_URL").'</td><td>';
|
print $langs->trans("PAYPAL_CSS_URL").'</td><td>';
|
||||||
@ -144,6 +162,27 @@ print '</table></form>';
|
|||||||
|
|
||||||
print '<br><br>';
|
print '<br><br>';
|
||||||
|
|
||||||
|
// Help doc
|
||||||
|
print '<u>'.$langs->trans("InformationToFindParameters","Paypal").'</u>:<br>';
|
||||||
|
if ($conf->use_javascript_ajax) print '<a href="#" id="apidoca">'.$langs->trans("ClickHere").'...</a>';
|
||||||
|
|
||||||
|
print '<div id="apidoc">';
|
||||||
|
print 'Your API authentication information can be found with following steps. We recommend that you open a separate Web browser session when carrying out this procedure.<br>
|
||||||
|
1. Log in to your PayPal Premier or Business account.<br>
|
||||||
|
2. Click the Profile subtab located under the My Account heading.<br>
|
||||||
|
3. Click the API Access link under the Account Information header.<br>
|
||||||
|
4. Click the View API Certificate link in the right column.<br>
|
||||||
|
5. Click the Request API signature radio button on the Request API Credentials page.<br>
|
||||||
|
6. Complete the Request API Credential Request form by clicking the agreement checkbox and clicking Submit.<br>
|
||||||
|
7. Save the values for API Username, Password and Signature (make sure this long character signature is copied).<br>
|
||||||
|
8. Click the "Modify" button after copying your API Username, Password, and Signature.
|
||||||
|
';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
print '<br><br>';
|
||||||
|
|
||||||
|
// Url list
|
||||||
print '<u>'.$langs->trans("FollowingUrlAreAvailableToMakePayments").':</u><br>';
|
print '<u>'.$langs->trans("FollowingUrlAreAvailableToMakePayments").':</u><br>';
|
||||||
// Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr'
|
// Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr'
|
||||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
|
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
|
||||||
|
|||||||
@ -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'];
|
if (isset($_SESSION['newtoken'])) $_SESSION['token'] = $_SESSION['newtoken'];
|
||||||
$_SESSION['newtoken'] = $token;
|
$_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("main");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$langs->load("paybox");
|
|
||||||
$langs->load("dict");
|
$langs->load("dict");
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
|
$langs->load("paybox");
|
||||||
|
|
||||||
// Input are:
|
// Input are:
|
||||||
// type ('invoice','order','contractline'),
|
// type ('invoice','order','contractline'),
|
||||||
@ -70,26 +61,27 @@ $langs->load("errors");
|
|||||||
|
|
||||||
if (empty($_REQUEST["currency"])) $currency=$conf->global->MAIN_MONNAIE;
|
if (empty($_REQUEST["currency"])) $currency=$conf->global->MAIN_MONNAIE;
|
||||||
else $currency=$_REQUEST["currency"];
|
else $currency=$_REQUEST["currency"];
|
||||||
if (empty($_REQUEST["amount"]) && empty($_REQUEST["source"]))
|
|
||||||
|
if (! GETPOST("action"))
|
||||||
{
|
{
|
||||||
dol_print_error('','ErrorBadParameters');
|
if (empty($_REQUEST["amount"]) && empty($_REQUEST["source"]))
|
||||||
session_destroy();
|
{
|
||||||
exit;
|
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"];
|
$suffix=GETPOST("suffix");
|
||||||
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"];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -306,7 +298,9 @@ if ($_REQUEST["source"] == 'order')
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
|
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
|
||||||
print ' ('.$langs->trans("ToComplete").')';
|
print ' ('.$langs->trans("ToComplete").')';
|
||||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$_REQUEST["EMAIL"].'"></td></tr>'."\n";
|
$email=$order->client->email;
|
||||||
|
$email=(GETPOST("EMAIL")?GETPOST("EMAIL"):(isValidEmail($email)?$email:''));
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$email.'"></td></tr>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -382,7 +376,9 @@ if ($_REQUEST["source"] == 'invoice')
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
|
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
|
||||||
print ' ('.$langs->trans("ToComplete").')';
|
print ' ('.$langs->trans("ToComplete").')';
|
||||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$_REQUEST["EMAIL"].'"></td></tr>'."\n";
|
$email=$invoice->client->email;
|
||||||
|
$email=(GETPOST("EMAIL")?GETPOST("EMAIL"):(isValidEmail($email)?$email:''));
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$email.'"></td></tr>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Payment on contract line
|
// Payment on contract line
|
||||||
@ -546,7 +542,9 @@ if ($_REQUEST["source"] == 'contractline')
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
|
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
|
||||||
print ' ('.$langs->trans("ToComplete").')';
|
print ' ('.$langs->trans("ToComplete").')';
|
||||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$_REQUEST["EMAIL"].'"></td></tr>'."\n";
|
$email=$contract->client->email;
|
||||||
|
$email=(GETPOST("EMAIL")?GETPOST("EMAIL"):(isValidEmail($email)?$email:''));
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$email.'"></td></tr>'."\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,7 +621,9 @@ if ($_REQUEST["source"] == 'membersubscription')
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
|
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
|
||||||
print ' ('.$langs->trans("ToComplete").')';
|
print ' ('.$langs->trans("ToComplete").')';
|
||||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$_REQUEST["EMAIL"].'"></td></tr>'."\n";
|
$email=$member->client->email;
|
||||||
|
$email=(GETPOST("EMAIL")?GETPOST("EMAIL"):(isValidEmail($email)?$email:''));
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$email.'"></td></tr>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -44,15 +44,6 @@ $token = md5(uniqid(mt_rand(),TRUE)); // Genere un hash d'un nombre aleatoire
|
|||||||
if (isset($_SESSION['newtoken'])) $_SESSION['token'] = $_SESSION['newtoken'];
|
if (isset($_SESSION['newtoken'])) $_SESSION['token'] = $_SESSION['newtoken'];
|
||||||
$_SESSION['newtoken'] = $token;
|
$_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("main");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$langs->load("dict");
|
$langs->load("dict");
|
||||||
@ -71,33 +62,35 @@ $langs->load("paypal");
|
|||||||
|
|
||||||
if (empty($_REQUEST["currency"])) $currency=$conf->global->MAIN_MONNAIE;
|
if (empty($_REQUEST["currency"])) $currency=$conf->global->MAIN_MONNAIE;
|
||||||
else $currency=$_REQUEST["currency"];
|
else $currency=$_REQUEST["currency"];
|
||||||
if (empty($_REQUEST["amount"]) && empty($_REQUEST["source"]))
|
|
||||||
|
var_dump($_POST);
|
||||||
|
if (! GETPOST("action"))
|
||||||
{
|
{
|
||||||
dol_print_error('','ErrorBadParameters');
|
if (empty($_REQUEST["amount"]) && empty($_REQUEST["source"]))
|
||||||
session_destroy();
|
{
|
||||||
exit;
|
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"];
|
$suffix=GETPOST("suffix");
|
||||||
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"];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
if ($_REQUEST["action"] == 'dopayment')
|
if (GETPOST("action") == 'dopayment')
|
||||||
{
|
{
|
||||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
|
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
|
||||||
|
|
||||||
@ -116,9 +109,11 @@ if ($_REQUEST["action"] == 'dopayment')
|
|||||||
|
|
||||||
if (empty($mesg))
|
if (empty($mesg))
|
||||||
{
|
{
|
||||||
//print_paypal_redirect($PAYPAL_API_PRICE, $conf->monnaie, $EMAIL, $urlok, $urlko, $TAG, $ID);
|
/*
|
||||||
|
print_paypal_redirect($PAYPAL_API_PRICE, $conf->monnaie, $EMAIL, $urlok, $urlko, $TAG, $ID);
|
||||||
|
exit;
|
||||||
|
|
||||||
/*global $conf, $langs, $db;
|
global $conf, $langs, $db;
|
||||||
global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE;
|
global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE;
|
||||||
global $PAYPAL_API_DEVISE, $PAYPAL_API_OK, $PAYPAL_API_KO;
|
global $PAYPAL_API_DEVISE, $PAYPAL_API_OK, $PAYPAL_API_KO;
|
||||||
global $PAYPAL_API_SANDBOX;
|
global $PAYPAL_API_SANDBOX;
|
||||||
@ -395,7 +390,9 @@ if ($_REQUEST["source"] == 'order')
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
|
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
|
||||||
print ' ('.$langs->trans("ToComplete").')';
|
print ' ('.$langs->trans("ToComplete").')';
|
||||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$_REQUEST["EMAIL"].'"></td></tr>'."\n";
|
$email=$order->client->email;
|
||||||
|
$email=(GETPOST("EMAIL")?GETPOST("EMAIL"):(isValidEmail($email)?$email:''));
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$email.'"></td></tr>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -471,7 +468,9 @@ if ($_REQUEST["source"] == 'invoice')
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
|
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
|
||||||
print ' ('.$langs->trans("ToComplete").')';
|
print ' ('.$langs->trans("ToComplete").')';
|
||||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$_REQUEST["EMAIL"].'"></td></tr>'."\n";
|
$email=$invoice->client->email;
|
||||||
|
$email=(GETPOST("EMAIL")?GETPOST("EMAIL"):(isValidEmail($email)?$email:''));
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$email.'"></td></tr>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Payment on contract line
|
// Payment on contract line
|
||||||
@ -635,7 +634,9 @@ if ($_REQUEST["source"] == 'contractline')
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
|
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
|
||||||
print ' ('.$langs->trans("ToComplete").')';
|
print ' ('.$langs->trans("ToComplete").')';
|
||||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$_REQUEST["EMAIL"].'"></td></tr>'."\n";
|
$email=$contract->client->email;
|
||||||
|
$email=(GETPOST("EMAIL")?GETPOST("EMAIL"):(isValidEmail($email)?$email:''));
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$email.'"></td></tr>'."\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,7 +713,9 @@ if ($_REQUEST["source"] == 'membersubscription')
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
|
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
|
||||||
print ' ('.$langs->trans("ToComplete").')';
|
print ' ('.$langs->trans("ToComplete").')';
|
||||||
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$_REQUEST["EMAIL"].'"></td></tr>'."\n";
|
$email=$member->client->email;
|
||||||
|
$email=(GETPOST("EMAIL")?GETPOST("EMAIL"):(isValidEmail($email)?$email:''));
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$email.'"></td></tr>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user