Skip to content

Commit

Permalink
Add hidden option message ONLINE_PAYMENT_MESSAGE_FORMIFVAT
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Sep 10, 2017
1 parent 2ae135b commit 9f1e349
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 9 deletions.
13 changes: 12 additions & 1 deletion htdocs/core/lib/payments.lib.php
Expand Up @@ -97,9 +97,10 @@ function payment_supplier_prepare_head(Paiement $object) {
* @param Translate $langs Output language
* @param int $addformmessage Add the payment form message
* @param string $suffix Suffix to use on constants
* @param Object $object Object related to payment
* @return void
*/
function htmlPrintOnlinePaymentFooter($fromcompany,$langs,$addformmessage=0,$suffix='')
function htmlPrintOnlinePaymentFooter($fromcompany,$langs,$addformmessage=0,$suffix='',$object=null)
{
global $conf;

Expand Down Expand Up @@ -156,10 +157,20 @@ function htmlPrintOnlinePaymentFooter($fromcompany,$langs,$addformmessage=0,$suf
print '<div class="center">'."\n";
if ($addformmessage)
{
print '<!-- object = '.$object->element.' -->';
print '<br>';

$parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix;
if (! empty($conf->global->$parammessageform)) print $conf->global->$parammessageform;
else if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $conf->global->ONLINE_PAYMENT_MESSAGE_FORM;

// Add other message if VAT exists
if (! empty($object->total_vat) || ! empty($object->total_tva))
{
$parammessageform='ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix;
if (! empty($conf->global->$parammessageform)) print $conf->global->$parammessageform;
else if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT;
}
}

print '<font style="font-size: 10px;"><br><hr>'."\n";
Expand Down
30 changes: 22 additions & 8 deletions htdocs/public/payment/newpayment.php
Expand Up @@ -66,6 +66,7 @@
$amount=price2num(GETPOST("amount",'alpha'));
if (! GETPOST("currency",'alpha')) $currency=$conf->currency;
else $currency=GETPOST("currency",'alpha');
$source = GETPOST("source",'alpha');

if (! $action)
{
Expand Down Expand Up @@ -607,8 +608,11 @@
$error=0;
$var=false;

$object = null;


// Free payment
if (! GETPOST("source"))
if (! $source)
{
$found=true;
$tag=GETPOST("tag");
Expand Down Expand Up @@ -655,7 +659,7 @@


// Payment on customer order
if (GETPOST("source") == 'order')
if ($source == 'order')
{
$found=true;
$langs->load("orders");
Expand All @@ -672,6 +676,8 @@
else
{
$result=$order->fetch_thirdparty($order->socid);

$object = $order;
}

if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
Expand Down Expand Up @@ -765,7 +771,7 @@


// Payment on customer invoice
if (GETPOST("source") == 'invoice')
if ($source == 'invoice')
{
$found=true;
$langs->load("bills");
Expand All @@ -782,6 +788,8 @@
else
{
$result=$invoice->fetch_thirdparty($invoice->socid);

$object = $invoice;
}

if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
Expand Down Expand Up @@ -874,14 +882,15 @@
}

// Payment on contract line
if (GETPOST("source") == 'contractline')
if ($source == 'contractline')
{
$found=true;
$langs->load("contracts");

require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';

$contractline=new ContratLigne($db);

$result=$contractline->fetch('',$ref);
if ($result < 0)
{
Expand All @@ -892,6 +901,8 @@
{
if ($contractline->fk_contrat > 0)
{
$object = $contractline;

$contract=new Contrat($db);
$result=$contract->fetch($contractline->fk_contrat);
if ($result > 0)
Expand All @@ -914,7 +925,8 @@
if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
{
$amount=$contractline->total_ttc;
if ($contractline->fk_product)

if ($contractline->fk_product && ! empty($conf->global-PAYMENT_USE_NEW_PRICE_FOR_CONTRACTLINES))
{
$product=new Product($db);
$result=$product->fetch($contractline->fk_product);
Expand All @@ -940,6 +952,7 @@
exit;
}
}

if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
$amount=price2num($amount);
}
Expand Down Expand Up @@ -1072,7 +1085,7 @@
}

// Payment on member subscription
if (GETPOST("source") == 'membersubscription')
if ($source == 'membersubscription')
{
$found=true;
$langs->load("members");
Expand All @@ -1089,6 +1102,8 @@
}
else
{
$object = $member;

$subscription=new Subscription($db);
}

Expand Down Expand Up @@ -1446,8 +1461,7 @@ function stripeTokenHandler(token) {
}



htmlPrintOnlinePaymentFooter($mysoc,$langs,1,$suffix);
htmlPrintOnlinePaymentFooter($mysoc,$langs,1,$suffix,$object);

llxFooter('', 'public');

Expand Down

0 comments on commit 9f1e349

Please sign in to comment.