diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index 6e81cb215b01c382cab7a323f4f2ae88e0e5252d..f55c86c60bf7470ec6b404d33e0dfd5534134bb4 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -21,7 +21,7 @@ /** \file htdocs/paypal/admin/paypal.php * \ingroup paypal * \brief Page to setup paypal module - * \version $Id: paypal.php,v 1.20 2011/07/08 08:30:49 hregis Exp $ + * \version $Id: paypal.php,v 1.21 2011/07/08 18:08:27 hregis Exp $ */ require("../../main.inc.php"); @@ -52,7 +52,6 @@ if ($_POST["action"] == 'setvalue' && $user->admin) $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); $result=dolibarr_set_const($db, "PAYPAL_SECURITY_TOKEN",$_POST["PAYPAL_SECURITY_TOKEN"],'chaine',0,'',$conf->entity); - $result=dolibarr_set_const($db, "PAYPAL_IPN_MAIL_ADDRESS",$_POST["PAYPAL_IPN_MAIL_ADDRESS"],'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "PAYPAL_ADD_PAYMENT_URL",$_POST["PAYPAL_ADD_PAYMENT_URL"],'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "PAYPAL_MESSAGE_OK",$_POST["PAYPAL_MESSAGE_OK"],'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "PAYPAL_MESSAGE_KO",$_POST["PAYPAL_MESSAGE_KO"],'chaine',0,'',$conf->entity); @@ -175,12 +174,6 @@ print '<input size="64" type="text" name="PAYPAL_CSS_URL" value="'.$conf->global print ' '.$langs->trans("Example").': http://mysite/mycss.css'; print '</td></tr>'; -$var=!$var; -print '<tr '.$bc[$var].'><td>'; -print $langs->trans("PAYPAL_IPN_MAIL_ADDRESS").'</td><td>'; -print '<input size="64" type="text" name="PAYPAL_IPN_MAIL_ADDRESS" value="'.$conf->global->PAYPAL_IPN_MAIL_ADDRESS.'">'; -print '</td></tr>'; - $var=!$var; print '<tr '.$bc[$var].'><td>'; print $langs->trans("SecurityToken").'</td><td>'; @@ -269,5 +262,5 @@ print info_admin($langs->trans("YouCanAddTagOnUrl")); $db->close(); -llxFooter('$Date: 2011/07/08 08:30:49 $ - $Revision: 1.20 $'); +llxFooter('$Date: 2011/07/08 18:08:27 $ - $Revision: 1.21 $'); ?> diff --git a/htdocs/public/paypal/ipn.php b/htdocs/public/paypal/ipn.php index 44362548434a2acf8c6db59ef1004a4df54c4e04..3223f2fa97fc15a0410b2f65bbfd3358bee0a55b 100644 --- a/htdocs/public/paypal/ipn.php +++ b/htdocs/public/paypal/ipn.php @@ -23,7 +23,7 @@ * Send an e-mail when the seller has received a Paypal payment. * If the transaction is OK, PayPal has the script connects and sends data, then the script sends an e-mail summarizing the seller. * Add the URL of the script during the creation of a Paypal button or the preferences of his Paypal account was: Preferences Instant Payment Notification. - * \version $Id: ipn.php,v 1.1 2011/07/08 08:30:50 hregis Exp $ + * \version $Id: ipn.php,v 1.2 2011/07/08 18:08:28 hregis Exp $ */ if (! defined('NOLOGIN')) define("NOLOGIN",1); // This means this output page does not require to be logged. @@ -44,11 +44,6 @@ if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_IPN_MAIL_AD $langs->load("main"); $langs->load("other"); - // From - $from = $conf->global->PAYPAL_IPN_MAIL_ADDRESS; - - // To - $sendto = $conf->global->PAYPAL_IPN_MAIL_ADDRESS; // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; @@ -70,9 +65,19 @@ if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_IPN_MAIL_AD // HTTP ERROR } else { fputs ($fp, $header . $req); - while (!feof($fp)) { + while (!feof($fp)) + { $res = fgets ($fp, 1024); - if (strcmp ($res, "VERIFIED") == 0) { + if (strcmp ($res, "VERIFIED") == 0) + { + // From + $from = GETPOST('receiver_email','',2); + + // To + $sendto = GETPOST('payer_email','',2); + + // CC + $sendtocc = GETPOST('receiver_email','',2); // Send mail // TODO add translation @@ -135,7 +140,13 @@ if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_IPN_MAIL_AD if (! $mail->error) $result=$mail->sendfile(); } else if (strcmp ($res, "INVALID") == 0) - { + { + // From + $from = GETPOST('receiver_email','',2); + + // To + $sendto = GETPOST('receiver_email','',2); + // Envoi d'un mail si invalide $subject = "[PAYPAL] Paiement PAYPAL NON VALIDE";