New: Add option to send email when paypal or paybox payment is done.

This commit is contained in:
Laurent Destailleur 2013-06-25 13:19:44 +02:00
parent 1d8b9949d6
commit 2d0a85d6f8
11 changed files with 72 additions and 27 deletions

View File

@ -17,7 +17,7 @@ For users:
- New: Show process id in all command line scripts.
- New: Module mailman can subscribe/unsubscribe to ML according to categories or type of member.
- New: Add object_hour as substitution tag for opendocument generation.
- New: Add option MEMBER_PAYONLINE_SENDEMAIL to send email when paypal or paybox payment is done.
- New: Add option to send email when paypal or paybox payment is done.
- New: Implement same rule for return value of all command line scripts (0 when success, <>0 if error).
- New: Clone product/service composition.
- New: [ task #926 ] Add extrafield feature on order lines.

View File

@ -33,3 +33,6 @@ VendorName=Name of vendor
CSSUrlForPaymentForm=CSS style sheet url for payment form
MessageOK=Message on validated payment return page
MessageKO=Message on canceled payment return page
NewPayboxPaymentReceived=New Paybox payment received
NewPayboxPaymentFailed=New Paybox payment tried but failed
PAYBOX_PAYONLINE_SENDEMAIL=EMail to warn after a payment (success or failed)

View File

@ -17,4 +17,7 @@ ThisIsTransactionId=This is id of transaction: <b>%s</b>
PAYPAL_ADD_PAYMENT_URL=Add the url of Paypal payment when you send a document by mail
PAYPAL_IPN_MAIL_ADDRESS=E-mail address for the instant notification of payment (IPN)
PredefinedMailContentLink=You can click on the secure link below to make your payment (PayPal) if it is not already done.\n\n%s\n\n
YouAreCurrentlyInSandboxMode=You are currently in the "sandbox" mode
YouAreCurrentlyInSandboxMode=You are currently in the "sandbox" mode
NewPaypalPaymentReceived=New Paypal payment received
NewPaypalPaymentFailed=New Paypal payment tried but failed
PAYPAL_PAYONLINE_SENDEMAIL=EMail to warn after a payment (success or not)

View File

@ -33,3 +33,6 @@ VendorName=Nom du vendeur
CSSUrlForPaymentForm=URL feuille style css pour le formulaire de paiement
MessageOK=Message sur page de retour de paiement validé
MessageKO=Message sur page de retour de paiement annulé
NewPayboxPaymentReceived=Nouveau paiement Paybox reçu
NewPayboxPaymentFailed=Nouveau paiement Paybox tenté mais en échec
PAYBOX_PAYONLINE_SENDEMAIL=EMail à prévenir en cas de paiement (succès ou non)

View File

@ -18,3 +18,7 @@ PAYPAL_ADD_PAYMENT_URL=Ajouter l'URL de paiement Paypal lors de l'envoi d'un doc
PAYPAL_IPN_MAIL_ADDRESS=Adresse email pour les notifications instantanées de paiement (IPN)
PredefinedMailContentLink=Vous pouvez cliquer sur le lien sécurisé ci-dessous pour effectuer votre paiement (Paypal) si ce dernier n'a pas encore été fait.\n\n%s\n\n
YouAreCurrentlyInSandboxMode=Vous êtes actuellement dans le mode "sandbox"
NewPaypalPaymentReceived=Nouveau paiement Paypal reçu
NewPaypalPaymentFailed=Nouveau paiement Paypal tenté mais en échec
PAYPAL_PAYONLINE_SENDEMAIL=EMail à prévenir en cas de paiement (succès ou non)

View File

@ -61,6 +61,8 @@ if ($action == 'setvalue' && $user->admin)
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYBOX_MESSAGE_KO",GETPOST('PAYBOX_MESSAGE_KO','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYBOX_PAYONLINE_SENDEMAIL",GETPOST('PAYBOX_PAYONLINE_SENDEMAIL'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
if (! $error)
{
@ -91,6 +93,16 @@ llxHeader();
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("PayBoxSetup"),$linkback,'setup');
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT."/paybox/admin/paybox.php";
$head[$h][1] = $langs->trans("Account");
$head[$h][2] = 'payboxaccount';
$h++;
dol_fiche_head($head, 'payboxaccount', '');
print $langs->trans("PayBoxDesc")."<br>\n";
print '<br>';
@ -186,9 +198,18 @@ $doleditor=new DolEditor('PAYBOX_MESSAGE_KO',$conf->global->PAYBOX_MESSAGE_KO,''
$doleditor->Create();
print '</td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("PAYBOX_PAYONLINE_SENDEMAIL").'</td><td>';
print '<input size="32" type="email" name="PAYBOX_PAYONLINE_SENDEMAIL" value="'.$conf->global->PAYBOX_PAYONLINE_SENDEMAIL.'">';
print ' &nbsp; '.$langs->trans("Example").': myemail@myserver.com';
print '</td></tr>';
print '<tr><td colspan="2" align="center"><br><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
print '</table></form>';
dol_fiche_end();
print '<br><br>';
print '<u>'.$langs->trans("FollowingUrlAreAvailableToMakePayments").':</u><br>';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.org>
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.org>
* Copyright (C) 2011-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
*
@ -63,11 +63,13 @@ if ($action == 'setvalue' && $user->admin)
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYPAL_ADD_PAYMENT_URL",GETPOST('PAYPAL_ADD_PAYMENT_URL','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYPAL_MESSAGE_OK",GETPOST('PAYPAL_MESSAGE_OK','alpha'),'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "PAYPAL_MESSAGE_OK",GETPOST('PAYPAL_MESSAGE_OK'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYPAL_MESSAGE_KO",GETPOST('PAYPAL_MESSAGE_KO','alpha'),'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, "PAYPAL_MESSAGE_KO",GETPOST('PAYPAL_MESSAGE_KO'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "PAYPAL_PAYONLINE_SENDEMAIL",GETPOST('PAYPAL_PAYONLINE_SENDEMAIL'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
if (! $error)
{
$db->commit();
@ -96,7 +98,7 @@ print '<br>';
$head=paypaladmin_prepare_head();
dol_fiche_head($head, 'paypalaccount', $langs->trans("ModuleSetup"));
dol_fiche_head($head, 'paypalaccount', '');
print $langs->trans("PaypalDesc")."<br>\n";
@ -201,6 +203,13 @@ $doleditor=new DolEditor('PAYPAL_MESSAGE_KO',$conf->global->PAYPAL_MESSAGE_KO,''
$doleditor->Create();
print '</td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("PAYPAL_PAYONLINE_SENDEMAIL").'</td><td>';
print '<input size="32" type="email" name="PAYPAL_PAYONLINE_SENDEMAIL" value="'.$conf->global->PAYPAL_PAYONLINE_SENDEMAIL.'">';
print ' &nbsp; '.$langs->trans("Example").': myemail@myserver.com';
print '</td></tr>';
$var=true;
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("UrlGenerationParameters").'</td>';

View File

@ -64,17 +64,17 @@ dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paybox');
// Send an email
if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=/',$fulltag))
if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL))
{
$sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL;
$sendto=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
$from=$conf->global->MAILING_EMAIL_FROM;
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile(
'New subscription payed',
'['.$conf->global->MAIN_APPLICATION_TITLE.'] '.$langs->trans("NewPayboxPaymentFailed"),
$sendto,
$from,
'New subscription payed '.$fulltag
);
$langs->trans("NewPayboxPaymentFailed")."\n".$fulltag
);
$result=$mailfile->sendfile();
if ($result)

View File

@ -94,16 +94,16 @@ dol_syslog("Call newpaymentok with token=".$token." paymentType=".$paymentType."
*/
// Send an email
if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=/',$fulltag))
if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL))
{
$sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL;
$sendto=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
$from=$conf->global->MAILING_EMAIL_FROM;
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile(
'New subscription payed',
'['.$conf->global->MAIN_APPLICATION_TITLE.'] '.$langs->trans("NewPayboxPaymentReceived"),
$sendto,
$from,
'New subscription payed '.$fulltag
$langs->trans("NewPayboxPaymentReceived")."\n".$fulltag
);
$result=$mailfile->sendfile();

View File

@ -72,17 +72,17 @@ dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paypal');
// Send an email
if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=/',$fulltag))
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
{
$sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL;
$sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
$from=$conf->global->MAILING_EMAIL_FROM;
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile(
'New subscription payed',
'['.$conf->global->MAIN_APPLICATION_TITLE.'] '.$langs->trans("NewPaypalPaymentFailed"),
$sendto,
$from,
'New subscription payed '.$fulltag
);
$langs->trans("NewPaypalPaymentFailed")."\ntag=".$fulltag."\ntoken=".$token." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt
);
$result=$mailfile->sendfile();
if ($result)

View File

@ -127,21 +127,23 @@ if ($PAYPALTOKEN)
// From env
$ipaddress = $_SESSION['ipaddress'];
dol_syslog("Call newpaymentok with token=".$token." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_paypal');
dol_syslog("Call paymentok with token=".$token." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_paypal');
// Send an email
if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=/',$fulltag))
//if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=/',$fulltag))
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
{
$sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL;
//$sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL;
$sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
$from=$conf->global->MAILING_EMAIL_FROM;
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile(
'New subscription payed',
'['.$conf->global->MAIN_APPLICATION_TITLE.'] '.$langs->trans("NewPaypalPaymentReceived"),
$sendto,
$from,
'New subscription payed '.$fulltag
);
$langs->trans("NewPaypalPaymentReceived")."\ntag=".$fulltag."\ntoken=".$token." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt
);
$result=$mailfile->sendfile();
if ($result)