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 Translate $langs Output language
* @param int $addformmessage Add the payment form message * @param int $addformmessage Add the payment form message
* @param string $suffix Suffix to use on constants * @param string $suffix Suffix to use on constants
* @param Object $object Object related to payment
* @return void * @return void
*/ */
function htmlPrintOnlinePaymentFooter($fromcompany,$langs,$addformmessage=0,$suffix='') function htmlPrintOnlinePaymentFooter($fromcompany,$langs,$addformmessage=0,$suffix='',$object=null)
{ {
global $conf; global $conf;
@ -156,10 +157,20 @@ function htmlPrintOnlinePaymentFooter($fromcompany,$langs,$addformmessage=0,$suf
print '<div class="center">'."\n"; print '<div class="center">'."\n";
if ($addformmessage) if ($addformmessage)
{ {
print '<!-- object = '.$object->element.' -->';
print '<br>'; print '<br>';
$parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix; $parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix;
if (! empty($conf->global->$parammessageform)) print $conf->global->$parammessageform; 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; 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"; print '<font style="font-size: 10px;"><br><hr>'."\n";

View File

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