Add hidden option message ONLINE_PAYMENT_MESSAGE_FORMIFVAT

This commit is contained in:
Laurent Destailleur 2017-09-10 22:24:26 +02:00
parent 2ae135baf1
commit 9f1e349506
2 changed files with 34 additions and 9 deletions

View File

@ -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;
@ -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";

View File

@ -66,6 +66,7 @@ $suffix=GETPOST("suffix",'aZ09');
$amount=price2num(GETPOST("amount",'alpha'));
if (! GETPOST("currency",'alpha')) $currency=$conf->currency;
else $currency=GETPOST("currency",'alpha');
$source = GETPOST("source",'alpha');
if (! $action)
{
@ -607,8 +608,11 @@ $found=false;
$error=0;
$var=false;
$object = null;
// Free payment
if (! GETPOST("source"))
if (! $source)
{
$found=true;
$tag=GETPOST("tag");
@ -655,7 +659,7 @@ if (! GETPOST("source"))
// Payment on customer order
if (GETPOST("source") == 'order')
if ($source == 'order')
{
$found=true;
$langs->load("orders");
@ -672,6 +676,8 @@ if (GETPOST("source") == 'order')
else
{
$result=$order->fetch_thirdparty($order->socid);
$object = $order;
}
if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
@ -765,7 +771,7 @@ if (GETPOST("source") == 'order')
// Payment on customer invoice
if (GETPOST("source") == 'invoice')
if ($source == 'invoice')
{
$found=true;
$langs->load("bills");
@ -782,6 +788,8 @@ if (GETPOST("source") == 'invoice')
else
{
$result=$invoice->fetch_thirdparty($invoice->socid);
$object = $invoice;
}
if ($action != 'dopayment') // Do not change amount if we just click on first dopayment
@ -874,7 +882,7 @@ if (GETPOST("source") == 'invoice')
}
// Payment on contract line
if (GETPOST("source") == 'contractline')
if ($source == 'contractline')
{
$found=true;
$langs->load("contracts");
@ -882,6 +890,7 @@ if (GETPOST("source") == 'contractline')
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
$contractline=new ContratLigne($db);
$result=$contractline->fetch('',$ref);
if ($result < 0)
{
@ -892,6 +901,8 @@ if (GETPOST("source") == 'contractline')
{
if ($contractline->fk_contrat > 0)
{
$object = $contractline;
$contract=new Contrat($db);
$result=$contract->fetch($contractline->fk_contrat);
if ($result > 0)
@ -914,7 +925,8 @@ if (GETPOST("source") == 'contractline')
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);
@ -940,6 +952,7 @@ if (GETPOST("source") == 'contractline')
exit;
}
}
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
$amount=price2num($amount);
}
@ -1072,7 +1085,7 @@ if (GETPOST("source") == 'contractline')
}
// Payment on member subscription
if (GETPOST("source") == 'membersubscription')
if ($source == 'membersubscription')
{
$found=true;
$langs->load("members");
@ -1089,6 +1102,8 @@ if (GETPOST("source") == 'membersubscription')
}
else
{
$object = $member;
$subscription=new Subscription($db);
}
@ -1446,8 +1461,7 @@ if (preg_match('/^dopayment/',$action))
}
htmlPrintOnlinePaymentFooter($mysoc,$langs,1,$suffix);
htmlPrintOnlinePaymentFooter($mysoc,$langs,1,$suffix,$object);
llxFooter('', 'public');