NEW Variable __ONLINE_PAYMENT_URL__ available in email templates
This commit is contained in:
parent
517301f014
commit
35938b1942
@ -865,7 +865,7 @@ class FormMail extends Form
|
||||
}
|
||||
}
|
||||
|
||||
// Complete substitution array
|
||||
// Complete substitution array with the url to make online payment
|
||||
$paymenturl='';
|
||||
if (empty($this->substit['__REF__']))
|
||||
{
|
||||
@ -883,7 +883,6 @@ class FormMail extends Form
|
||||
$url=getOnlinePaymentUrl(0, $typeforonlinepayment, $this->substit['__REF__']);
|
||||
$paymenturl=$url;
|
||||
}
|
||||
|
||||
$this->substit['__ONLINE_PAYMENT_URL__']=$paymenturl;
|
||||
|
||||
//Add lines substitution key from each line
|
||||
|
||||
@ -5729,11 +5729,31 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
|
||||
$substitutionarray=array();
|
||||
|
||||
if (empty($exclude) || ! in_array('system', $exclude))
|
||||
if (empty($exclude) || ! in_array('user', $exclude))
|
||||
{
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$outputlangs->trans('TranslationOfKey');
|
||||
$substitutionarray['__[AnyConstantKey]__']=$outputlangs->trans('ValueOfConstant');
|
||||
$substitutionarray['__DOL_MAIN_URL_ROOT__']=DOL_MAIN_URL_ROOT;
|
||||
// Add SIGNATURE into substitutionarray first, so, when we will make the substitution,
|
||||
// this will include signature content first and then replace var found into content of signature
|
||||
$signature = $user->signature;
|
||||
$substitutionarray=array_merge($substitutionarray, array(
|
||||
'__USER_SIGNATURE__' => (string) (($signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($signature), 30) : $signature) : '')
|
||||
)
|
||||
);
|
||||
// For backward compatibility
|
||||
if ($onlykey != 2)
|
||||
{
|
||||
$substitutionarray['__SIGNATURE__'] = (string) (($signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($signature), 30) : $signature) : '');
|
||||
}
|
||||
|
||||
$substitutionarray=array_merge($substitutionarray, array(
|
||||
'__USER_ID__' => (string) $user->id,
|
||||
'__USER_LOGIN__' => (string) $user->login,
|
||||
'__USER_LASTNAME__' => (string) $user->lastname,
|
||||
'__USER_FIRSTNAME__' => (string) $user->firstname,
|
||||
'__USER_FULLNAME__' => (string) $user->getFullName($outputlangs),
|
||||
'__USER_SUPERVISOR_ID__' => (string) ($user->fk_user ? $user->fk_user : '0'),
|
||||
'__USER_REMOTE_IP__' => (string) $_SERVER['REMOTE_ADDR']
|
||||
)
|
||||
);
|
||||
}
|
||||
if ((empty($exclude) || ! in_array('mycompany', $exclude)) && is_object($mysoc))
|
||||
{
|
||||
@ -5804,7 +5824,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
$substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : ''));
|
||||
$substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : '');
|
||||
|
||||
// TODO USe this ?
|
||||
// TODO Use this ?
|
||||
$msgishtml = 0;
|
||||
|
||||
$birthday = dol_print_date($object->birth,'day');
|
||||
@ -5881,7 +5901,26 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
}
|
||||
}
|
||||
|
||||
$substitutionarray['__ONLINE_PAYMENT_URL__'] = 'TODO';
|
||||
// Complete substitution array with the url to make online payment
|
||||
$paymenturl='';
|
||||
if (empty($substitutionarray['__REF__']))
|
||||
{
|
||||
$paymenturl='';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the online payment url link into __ONLINE_PAYMENT_URL__ key
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
$outputlangs->load('paypal');
|
||||
$typeforonlinepayment='free';
|
||||
if (is_object($object) && $object->element == 'commande') $typeforonlinepayment='order';
|
||||
if (is_object($object) && $object->element == 'facture') $typeforonlinepayment='invoice';
|
||||
if (is_object($object) && $object->element == 'member') $typeforonlinepayment='member';
|
||||
$url=getOnlinePaymentUrl(0, $typeforonlinepayment, $substitutionarray['__REF__']);
|
||||
$paymenturl=$url;
|
||||
}
|
||||
|
||||
$substitutionarray['__ONLINE_PAYMENT_URL__']=$paymenturl;
|
||||
}
|
||||
}
|
||||
if (empty($exclude) || ! in_array('objectamount', $exclude))
|
||||
@ -5931,31 +5970,11 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
));
|
||||
}
|
||||
|
||||
if (empty($exclude) || ! in_array('user', $exclude))
|
||||
if (empty($exclude) || ! in_array('system', $exclude))
|
||||
{
|
||||
// Add SIGNATURE into substitutionarray first, so, when we will make the substitution,
|
||||
// this will also replace var found into content of signature
|
||||
$signature = $user->signature;
|
||||
$substitutionarray=array_merge($substitutionarray, array(
|
||||
'__USER_SIGNATURE__' => (string) (($signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($signature), 30) : $signature) : '')
|
||||
)
|
||||
);
|
||||
// For backward compatibility
|
||||
if ($onlykey != 2)
|
||||
{
|
||||
$substitutionarray['__SIGNATURE__'] = (string) (($signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($signature), 30) : $signature) : '');
|
||||
}
|
||||
|
||||
$substitutionarray=array_merge($substitutionarray, array(
|
||||
'__USER_ID__' => (string) $user->id,
|
||||
'__USER_LOGIN__' => (string) $user->login,
|
||||
'__USER_LASTNAME__' => (string) $user->lastname,
|
||||
'__USER_FIRSTNAME__' => (string) $user->firstname,
|
||||
'__USER_FULLNAME__' => (string) $user->getFullName($outputlangs),
|
||||
'__USER_SUPERVISOR_ID__' => (string) ($user->fk_user ? $user->fk_user : '0'),
|
||||
'__USER_REMOTE_IP__' => (string) $_SERVER['REMOTE_ADDR']
|
||||
)
|
||||
);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$outputlangs->trans('TranslationOfKey');
|
||||
$substitutionarray['__[AnyConstantKey]__']=$outputlangs->trans('ValueOfConstant');
|
||||
$substitutionarray['__DOL_MAIN_URL_ROOT__']=DOL_MAIN_URL_ROOT;
|
||||
}
|
||||
if (! empty($conf->multicompany->enabled))
|
||||
{
|
||||
|
||||
@ -190,7 +190,7 @@ function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='yo
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($type == 'membersubscription')
|
||||
if ($type == 'member' || $type == 'membersubscription')
|
||||
{
|
||||
$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'<font color="#666666">':'');
|
||||
if ($mode == 1) $out.='member_ref';
|
||||
|
||||
@ -276,12 +276,12 @@ class Holiday extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* List holidays for a particular user
|
||||
* List holidays for a particular user or list of users
|
||||
*
|
||||
* @param int $user_id ID of user to list
|
||||
* @param string $order Sort order
|
||||
* @param string $filter SQL Filter
|
||||
* @return int -1 if KO, 1 if OK, 2 if no result
|
||||
* @param int|string $user_id ID of user to list, or comma separated list of IDs of users to list
|
||||
* @param string $order Sort order
|
||||
* @param string $filter SQL Filter
|
||||
* @return int -1 if KO, 1 if OK, 2 if no result
|
||||
*/
|
||||
function fetchByUser($user_id, $order='', $filter='')
|
||||
{
|
||||
@ -321,8 +321,8 @@ class Holiday extends CommonObject
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp, ".MAIN_DB_PREFIX."user as uu, ".MAIN_DB_PREFIX."user as ua";
|
||||
$sql.= " WHERE cp.entity IN (".getEntity('holiday').")";
|
||||
$sql.= " AND cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau
|
||||
$sql.= " AND cp.fk_user = ".$user_id;
|
||||
$sql.= " AND cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid"; // Hack pour la recherche sur le tableau
|
||||
$sql.= " AND cp.fk_user IN (".$user_id.")";
|
||||
|
||||
// Filtre de séléction
|
||||
if(!empty($filter)) {
|
||||
|
||||
@ -183,4 +183,4 @@ EmailSentToMember=Email sent to member at %s
|
||||
SendReminderForExpiredSubscriptionTitle=Send reminder by email for expired subscription
|
||||
SendReminderForExpiredSubscription=Send reminder by email to members when subscription is about to expire (parameter is number of days before end of subscription to send the remind)
|
||||
YourSubscriptionHasExpired=Your subscription has expired
|
||||
ThisIsContentOfSubscriptionReminderEmail=This is a email to remind you that your subscription is about to expire.
|
||||
ThisIsContentOfSubscriptionReminderEmail=This is an email to remind you that your subscription is about to expire.
|
||||
|
||||
@ -46,7 +46,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php';
|
||||
// Security check
|
||||
// No check on module enabled. Done later according to $validpaymentmethod
|
||||
|
||||
$langs->loadLangs(array("main","other","dict","bills","companies","errors","paybox")); // File with generic data
|
||||
$langs->loadLangs(array("main","other","dict","bills","companies","errors","paybox","paypal")); // File with generic data
|
||||
|
||||
$action=GETPOST('action','aZ09');
|
||||
|
||||
@ -157,8 +157,6 @@ $urlko=preg_replace('/&$/','',$urlko); // Remove last &
|
||||
|
||||
if (! empty($conf->paypal->enabled))
|
||||
{
|
||||
$langs->load("paypal");
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user