Works on enhancement of paypal module
New: add triggers for post treatment New: possibility to add payment link to email
This commit is contained in:
parent
1f7a11d012
commit
1eccc31f36
@ -474,6 +474,26 @@ class FormMail
|
||||
if ($this->param["models"]=='order_supplier_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendSupplierOrder"); }
|
||||
if ($this->param["models"]=='invoice_supplier_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendSupplierInvoice"); }
|
||||
if ($this->param["models"]=='shipping_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendShipping"); }
|
||||
|
||||
if ($conf->paypal->enabled && $conf->global->PAYPAL_ADD_PAYMENT_URL)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/security.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypal.lib.php");
|
||||
|
||||
$langs->load('paypal');
|
||||
|
||||
if ($this->param["models"]=='order_send')
|
||||
{
|
||||
$url=getPaymentUrl('order',$this->substit['__ORDERREF__']);
|
||||
$defaultmessage=$langs->transnoentities("PredefinedMailContentSendOrderWithPaypalLink",$url);
|
||||
}
|
||||
if ($this->param["models"]=='facture_send')
|
||||
{
|
||||
$url=getPaymentUrl('invoice',$this->substit['__FACREF__']);
|
||||
$defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoiceWithPaypalLink",$url);
|
||||
}
|
||||
}
|
||||
|
||||
$defaultmessage=make_substitutions($defaultmessage,$this->substit);
|
||||
if (isset($_POST["message"])) $defaultmessage=$_POST["message"];
|
||||
$defaultmessage=str_replace('\n',"\n",$defaultmessage);
|
||||
|
||||
@ -150,6 +150,27 @@ function paypaladmin_prepare_head()
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function getPaymentUrl($source='',$ref='',$amount=0,$freetag='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (! empty($source) && ! empty($ref))
|
||||
{
|
||||
$token='';
|
||||
if (! empty($conf->global->PAYPAL_SECURITY_TOKEN)) $token='&securekey='.dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.$ref, 2);
|
||||
|
||||
if ($source == 'commande') $source = 'order';
|
||||
if ($source == 'facture') $source = 'invoice';
|
||||
|
||||
$url = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source='.$source.'&ref='.$ref.$token;
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send redirect to paypal to browser
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user