diff --git a/ChangeLog b/ChangeLog index a834607cdb4..e7d2e862f15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/htdocs/langs/en_US/paybox.lang b/htdocs/langs/en_US/paybox.lang index 7521d518072..f39fc01911f 100644 --- a/htdocs/langs/en_US/paybox.lang +++ b/htdocs/langs/en_US/paybox.lang @@ -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) diff --git a/htdocs/langs/en_US/paypal.lang b/htdocs/langs/en_US/paypal.lang index b270ea68d38..fe383229d35 100644 --- a/htdocs/langs/en_US/paypal.lang +++ b/htdocs/langs/en_US/paypal.lang @@ -17,4 +17,7 @@ ThisIsTransactionId=This is id of transaction: %s 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 \ No newline at end of file +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) \ No newline at end of file diff --git a/htdocs/langs/fr_FR/paybox.lang b/htdocs/langs/fr_FR/paybox.lang index ae1a97c435e..dcfd4ac1fd3 100644 --- a/htdocs/langs/fr_FR/paybox.lang +++ b/htdocs/langs/fr_FR/paybox.lang @@ -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) diff --git a/htdocs/langs/fr_FR/paypal.lang b/htdocs/langs/fr_FR/paypal.lang index 28eeff81a3d..3f6e2a55af5 100644 --- a/htdocs/langs/fr_FR/paypal.lang +++ b/htdocs/langs/fr_FR/paypal.lang @@ -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) + diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php index 75704d83c3a..c55574d363a 100644 --- a/htdocs/paybox/admin/paybox.php +++ b/htdocs/paybox/admin/paybox.php @@ -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=''.$langs->trans("BackToModuleList").''; 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")."
\n"; print '
'; @@ -186,9 +198,18 @@ $doleditor=new DolEditor('PAYBOX_MESSAGE_KO',$conf->global->PAYBOX_MESSAGE_KO,'' $doleditor->Create(); print ''; +$var=!$var; +print ''; +print $langs->trans("PAYBOX_PAYONLINE_SENDEMAIL").''; +print ''; +print '   '.$langs->trans("Example").': myemail@myserver.com'; +print ''; + print '
'; print ''; +dol_fiche_end(); + print '

'; print ''.$langs->trans("FollowingUrlAreAvailableToMakePayments").':
'; diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index efa3891cd18..998f724dc68 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2011 Laurent Destailleur + * Copyright (C) 2005-2013 Laurent Destailleur * Copyright (C) 2011-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * @@ -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 '
'; $head=paypaladmin_prepare_head(); -dol_fiche_head($head, 'paypalaccount', $langs->trans("ModuleSetup")); +dol_fiche_head($head, 'paypalaccount', ''); print $langs->trans("PaypalDesc")."
\n"; @@ -201,6 +203,13 @@ $doleditor=new DolEditor('PAYPAL_MESSAGE_KO',$conf->global->PAYPAL_MESSAGE_KO,'' $doleditor->Create(); print ''; +$var=!$var; +print ''; +print $langs->trans("PAYPAL_PAYONLINE_SENDEMAIL").''; +print ''; +print '   '.$langs->trans("Example").': myemail@myserver.com'; +print ''; + $var=true; print ''; print ''.$langs->trans("UrlGenerationParameters").''; diff --git a/htdocs/public/paybox/paymentko.php b/htdocs/public/paybox/paymentko.php index de05e2a4ac1..8dc175e221b 100644 --- a/htdocs/public/paybox/paymentko.php +++ b/htdocs/public/paybox/paymentko.php @@ -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) diff --git a/htdocs/public/paybox/paymentok.php b/htdocs/public/paybox/paymentok.php index 6af144c353c..323a8f3b395 100644 --- a/htdocs/public/paybox/paymentok.php +++ b/htdocs/public/paybox/paymentok.php @@ -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(); diff --git a/htdocs/public/paypal/paymentko.php b/htdocs/public/paypal/paymentko.php index 69fa80eb9cb..730e0e954fb 100755 --- a/htdocs/public/paypal/paymentko.php +++ b/htdocs/public/paypal/paymentko.php @@ -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) diff --git a/htdocs/public/paypal/paymentok.php b/htdocs/public/paypal/paymentok.php index 5e822fd75d1..35dc64d377c 100755 --- a/htdocs/public/paypal/paymentok.php +++ b/htdocs/public/paypal/paymentok.php @@ -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)