Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
506ba30d5a
@ -641,7 +641,9 @@ if (empty($reshook))
|
|||||||
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
|
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
|
||||||
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
|
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
|
||||||
|
|
||||||
$result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, 2);
|
$moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n";
|
||||||
|
|
||||||
|
$result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
@ -713,7 +715,9 @@ if (empty($reshook))
|
|||||||
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
|
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
|
||||||
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs);
|
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs);
|
||||||
|
|
||||||
$result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1);
|
$moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n";
|
||||||
|
|
||||||
|
$result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
|
||||||
}
|
}
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -140,7 +140,7 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Function sending an email has the adherent with the text supplied in parameter.
|
* Function sending an email to the current member with the text supplied in parameter.
|
||||||
*
|
*
|
||||||
* @param string $text Content of message (not html entities encoded)
|
* @param string $text Content of message (not html entities encoded)
|
||||||
* @param string $subject Subject of message
|
* @param string $subject Subject of message
|
||||||
@ -152,9 +152,10 @@ class Adherent extends CommonObject
|
|||||||
* @param int $deliveryreceipt Ask a delivery receipt
|
* @param int $deliveryreceipt Ask a delivery receipt
|
||||||
* @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
|
* @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
|
||||||
* @param string $errors_to erros to
|
* @param string $errors_to erros to
|
||||||
|
* @param string $moreinheader Add more html headers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function send_an_email($text, $subject, $filename_list=array(), $mimetype_list=array(), $mimefilename_list=array(), $addr_cc="", $addr_bcc="", $deliveryreceipt=0, $msgishtml=-1, $errors_to='')
|
function send_an_email($text, $subject, $filename_list=array(), $mimetype_list=array(), $mimefilename_list=array(), $addr_cc="", $addr_bcc="", $deliveryreceipt=0, $msgishtml=-1, $errors_to='', $moreinheader='')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
@ -176,9 +177,11 @@ class Adherent extends CommonObject
|
|||||||
$from=$conf->email_from;
|
$from=$conf->email_from;
|
||||||
if (! empty($conf->global->ADHERENT_MAIL_FROM)) $from=$conf->global->ADHERENT_MAIL_FROM;
|
if (! empty($conf->global->ADHERENT_MAIL_FROM)) $from=$conf->global->ADHERENT_MAIL_FROM;
|
||||||
|
|
||||||
|
$trackid = 'mem'.$this->id;
|
||||||
|
|
||||||
// Send email (substitutionarray must be done just before this)
|
// Send email (substitutionarray must be done just before this)
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||||
$mailfile = new CMailFile($subjecttosend, $this->email, $from, $texttosend, $filename_list, $mimetype_list, $mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml);
|
$mailfile = new CMailFile($subjecttosend, $this->email, $from, $texttosend, $filename_list, $mimetype_list, $mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml, '', '', $trackid, $moreinheader);
|
||||||
if ($mailfile->sendfile())
|
if ($mailfile->sendfile())
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
@ -2648,8 +2651,11 @@ class Adherent extends CommonObject
|
|||||||
$from = $conf->global->ADHERENT_MAIL_FROM;
|
$from = $conf->global->ADHERENT_MAIL_FROM;
|
||||||
$to = $adherent->email;
|
$to = $adherent->email;
|
||||||
|
|
||||||
|
$trackid = 'mem'.$adherent->id;
|
||||||
|
$moreinheader='X-Dolibarr-Info: sendReminderForExpiredSubscription'."\r\n";
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||||
$cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1);
|
$cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1, '', '', $trackid, $moreinheader);
|
||||||
$result = $cmail->sendfile();
|
$result = $cmail->sendfile();
|
||||||
if (! $result)
|
if (! $result)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -394,7 +394,9 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
$listofmimes=array(dol_mimetype($file));
|
$listofmimes=array(dol_mimetype($file));
|
||||||
}
|
}
|
||||||
|
|
||||||
$result=$object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofnames, $listofmimes, "", "", 0, -1);
|
$moreinheader='X-Dolibarr-Info: send_an_email by adherents/subscription.php'."\r\n";
|
||||||
|
|
||||||
|
$result=$object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofnames, $listofmimes, "", "", 0, -1, '', $moreinheader);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$errmsg=$object->error;
|
$errmsg=$object->error;
|
||||||
|
|||||||
@ -298,7 +298,9 @@ if ($action == 'add')
|
|||||||
|
|
||||||
if ($subjecttosend && $texttosend)
|
if ($subjecttosend && $texttosend)
|
||||||
{
|
{
|
||||||
$result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1);
|
$moreinheader='X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n";
|
||||||
|
|
||||||
|
$result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
|
||||||
}
|
}
|
||||||
/*if ($result < 0)
|
/*if ($result < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -410,7 +410,10 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled))
|
|||||||
$stripeToken = GETPOST("stripeToken",'alpha');
|
$stripeToken = GETPOST("stripeToken",'alpha');
|
||||||
$email = GETPOST("email",'alpha');
|
$email = GETPOST("email",'alpha');
|
||||||
$thirdparty_id=GETPOST('thirdparty_id', 'int'); // Note that for payment following online registration for members, this is empty because thirdparty is created once payment is confirmed by paymentok.php
|
$thirdparty_id=GETPOST('thirdparty_id', 'int'); // Note that for payment following online registration for members, this is empty because thirdparty is created once payment is confirmed by paymentok.php
|
||||||
$vatnumber = GETPOST('vatnumber','alpha');
|
$dol_type=(GETPOST('s', 'alpha') ? GETPOST('s', 'alpha') : GETPOST('source', 'alpha'));
|
||||||
|
$dol_id=GETPOST('dol_id', 'int');
|
||||||
|
$vatnumber = GETPOST('vatnumber','alpha');
|
||||||
|
$savesource=GETPOST('savesource', 'int');
|
||||||
|
|
||||||
dol_syslog("stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe');
|
dol_syslog("stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe');
|
||||||
dol_syslog("email = ".$email, LOG_DEBUG, 0, '_stripe');
|
dol_syslog("email = ".$email, LOG_DEBUG, 0, '_stripe');
|
||||||
@ -421,12 +424,12 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled))
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$metadata = array(
|
$metadata = array(
|
||||||
'dol_version'=>DOL_VERSION,
|
'dol_version' => DOL_VERSION,
|
||||||
'dol_entity'=>$conf->entity,
|
'dol_entity' => $conf->entity,
|
||||||
|
'dol_company' => $mysoc->name, // Usefull when using multicompany
|
||||||
'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])
|
'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])
|
||||||
);
|
);
|
||||||
if (! empty($dol_id)) $metadata["dol_id"] = $dol_id;
|
|
||||||
if (! empty($dol_type)) $metadata["dol_type"] = $dol_type;
|
|
||||||
if (! empty($thirdparty_id)) $metadata["dol_thirdparty_id"] = $thirdparty_id;
|
if (! empty($thirdparty_id)) $metadata["dol_thirdparty_id"] = $thirdparty_id;
|
||||||
|
|
||||||
if ($thirdparty_id > 0)
|
if ($thirdparty_id > 0)
|
||||||
@ -452,7 +455,9 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled))
|
|||||||
$customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1);
|
$customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1);
|
||||||
|
|
||||||
// Create Stripe card from Token
|
// Create Stripe card from Token
|
||||||
|
if (! empty($savesource)) {
|
||||||
$card = $customer->sources->create(array("source" => $stripeToken, "metadata" => $metadata));
|
$card = $customer->sources->create(array("source" => $stripeToken, "metadata" => $metadata));
|
||||||
|
} else { $card = $stripeToken; }
|
||||||
|
|
||||||
if (empty($card))
|
if (empty($card))
|
||||||
{
|
{
|
||||||
@ -463,13 +468,17 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (! empty($FULLTAG)) $metadata["FULLTAG"] = $FULLTAG;
|
||||||
|
if (! empty($dol_id)) $metadata["dol_id"] = $dol_id;
|
||||||
|
if (! empty($dol_type)) $metadata["dol_type"] = $dol_type;
|
||||||
|
|
||||||
dol_syslog("Create charge on card ".$card->id, LOG_DEBUG, 0, '_stripe');
|
dol_syslog("Create charge on card ".$card->id, LOG_DEBUG, 0, '_stripe');
|
||||||
$charge = \Stripe\Charge::create(array(
|
$charge = \Stripe\Charge::create(array(
|
||||||
'amount' => price2num($amountstripe, 'MU'),
|
'amount' => price2num($amountstripe, 'MU'),
|
||||||
'currency' => $currency,
|
'currency' => $currency,
|
||||||
'capture' => true, // Charge immediatly
|
'capture' => true, // Charge immediatly
|
||||||
'description' => 'Stripe payment: '.$FULLTAG,
|
'description' => 'Stripe payment: '.$FULLTAG,
|
||||||
'metadata' => array("FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])),
|
'metadata' => $metadata,
|
||||||
'customer' => $customer->id,
|
'customer' => $customer->id,
|
||||||
'source' => $card,
|
'source' => $card,
|
||||||
'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt
|
'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt
|
||||||
@ -496,6 +505,10 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled))
|
|||||||
));
|
));
|
||||||
// Return $customer = array('id'=>'cus_XXXX', ...)
|
// Return $customer = array('id'=>'cus_XXXX', ...)
|
||||||
|
|
||||||
|
if (! empty($FULLTAG)) $metadata["FULLTAG"] = $FULLTAG;
|
||||||
|
if (! empty($dol_id)) $metadata["dol_id"] = $dol_id;
|
||||||
|
if (! empty($dol_type)) $metadata["dol_type"] = $dol_type;
|
||||||
|
|
||||||
// The customer was just created with a source, so we can make a charge
|
// The customer was just created with a source, so we can make a charge
|
||||||
// with no card defined, the source just used for customer creation will be used.
|
// with no card defined, the source just used for customer creation will be used.
|
||||||
dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe');
|
dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe');
|
||||||
@ -505,7 +518,7 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled))
|
|||||||
'currency' => $currency,
|
'currency' => $currency,
|
||||||
'capture' => true, // Charge immediatly
|
'capture' => true, // Charge immediatly
|
||||||
'description' => 'Stripe payment: '.$FULLTAG,
|
'description' => 'Stripe payment: '.$FULLTAG,
|
||||||
'metadata' => array("FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])),
|
'metadata' => $metadata,
|
||||||
'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt
|
'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt
|
||||||
),array("idempotency_key" => "$ref","stripe_account" => "$stripeacc"));
|
),array("idempotency_key" => "$ref","stripe_account" => "$stripeacc"));
|
||||||
// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...)
|
// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...)
|
||||||
@ -822,6 +835,7 @@ if ($source == 'order')
|
|||||||
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
|
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
|
||||||
print '<input type="hidden" name="s" value="'.dol_escape_htmltag($source).'">';
|
print '<input type="hidden" name="s" value="'.dol_escape_htmltag($source).'">';
|
||||||
print '<input type="hidden" name="ref" value="'.dol_escape_htmltag($order->ref).'">';
|
print '<input type="hidden" name="ref" value="'.dol_escape_htmltag($order->ref).'">';
|
||||||
|
print '<input type="hidden" name="dol_id" value="'.dol_escape_htmltag($order->id).'">';
|
||||||
$directdownloadlink = $order->getLastMainDocLink('commande');
|
$directdownloadlink = $order->getLastMainDocLink('commande');
|
||||||
if ($directdownloadlink)
|
if ($directdownloadlink)
|
||||||
{
|
{
|
||||||
@ -941,6 +955,7 @@ if ($source == 'invoice')
|
|||||||
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
|
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
|
||||||
print '<input type="hidden" name="s" value="'.dol_escape_htmltag($source).'">';
|
print '<input type="hidden" name="s" value="'.dol_escape_htmltag($source).'">';
|
||||||
print '<input type="hidden" name="ref" value="'.dol_escape_htmltag($invoice->ref).'">';
|
print '<input type="hidden" name="ref" value="'.dol_escape_htmltag($invoice->ref).'">';
|
||||||
|
print '<input type="hidden" name="dol_id" value="'.dol_escape_htmltag($invoice->id).'">';
|
||||||
$directdownloadlink = $invoice->getLastMainDocLink('facture');
|
$directdownloadlink = $invoice->getLastMainDocLink('facture');
|
||||||
if ($directdownloadlink)
|
if ($directdownloadlink)
|
||||||
{
|
{
|
||||||
@ -1139,6 +1154,7 @@ if ($source == 'contractline')
|
|||||||
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
|
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
|
||||||
print '<input type="hidden" name="source" value="'.dol_escape_htmltag($source).'">';
|
print '<input type="hidden" name="source" value="'.dol_escape_htmltag($source).'">';
|
||||||
print '<input type="hidden" name="ref" value="'.dol_escape_htmltag($contractline->ref).'">';
|
print '<input type="hidden" name="ref" value="'.dol_escape_htmltag($contractline->ref).'">';
|
||||||
|
print '<input type="hidden" name="dol_id" value="'.dol_escape_htmltag($contractline->id).'">';
|
||||||
$directdownloadlink = $contract->getLastMainDocLink('contract');
|
$directdownloadlink = $contract->getLastMainDocLink('contract');
|
||||||
if ($directdownloadlink)
|
if ($directdownloadlink)
|
||||||
{
|
{
|
||||||
@ -1545,7 +1561,6 @@ if (preg_match('/^dopayment/',$action))
|
|||||||
<div id="card-element">
|
<div id="card-element">
|
||||||
<!-- a Stripe Element will be inserted here. -->
|
<!-- a Stripe Element will be inserted here. -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Used to display form errors -->
|
<!-- Used to display form errors -->
|
||||||
<div id="card-errors" role="alert"></div>
|
<div id="card-errors" role="alert"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -1556,8 +1571,6 @@ if (preg_match('/^dopayment/',$action))
|
|||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
<script src="https://js.stripe.com/v2/"></script>
|
|
||||||
<script src="https://js.stripe.com/v3/"></script>
|
<script src="https://js.stripe.com/v3/"></script>
|
||||||
|
|
||||||
<script type="text/javascript" language="javascript">';
|
<script type="text/javascript" language="javascript">';
|
||||||
|
|||||||
@ -551,7 +551,9 @@ if ($ispaymentok)
|
|||||||
$listofmimes=array(dol_mimetype($file));
|
$listofmimes=array(dol_mimetype($file));
|
||||||
}
|
}
|
||||||
|
|
||||||
$result=$object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1);
|
$moreinheader='X-Dolibarr-Info: send_an_email by public/payment/paymentok.php'."\r\n";
|
||||||
|
|
||||||
|
$result=$object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, "", $moreinheader);
|
||||||
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -150,7 +150,7 @@ if ($resql)
|
|||||||
$companystatic->canvas=$obj->canvas;
|
$companystatic->canvas=$obj->canvas;
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>';
|
print '<td class="nowraponall">';
|
||||||
print $fuserstatic->getNomUrl(-1);
|
print $fuserstatic->getNomUrl(-1);
|
||||||
if (! empty($conf->multicompany->enabled) && $obj->admin && ! $obj->entity)
|
if (! empty($conf->multicompany->enabled) && $obj->admin && ! $obj->entity)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user