diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php
index 3b7facc9dc8..b9c994fba28 100644
--- a/htdocs/admin/facture.php
+++ b/htdocs/admin/facture.php
@@ -262,23 +262,6 @@ if ($action == 'setforcedate')
}
}
-if ($action == 'set_INVOICE_AUTO_FILLJS')
-{
- $freetext = GETPOST('INVOICE_AUTO_FILLJS'); // No alpha here, we want exact string
-
- $res = dolibarr_set_const($db, "INVOICE_AUTO_FILLJS",$freetext,'chaine',0,'',$conf->entity);
-
- if (! $res > 0) $error++;
-
- if (! $error)
- {
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- }
- else
- {
- setEventMessages($langs->trans("Error"), null, 'errors');
- }
-}
/*
@@ -750,20 +733,6 @@ print '\n";
print '';
-// Add js auto fill amount on paiement form
-$var=! $var;
-print '
';
print '| '.$arraytitle.' | ';
print ''.$langs->trans('Date').' | ';
- print ''.$langs->trans('AmountTTC').' | ';
+ if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('Currency').' | ';
if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyAmountTTC').' | ';
- print ''.$alreadypayedlabel.' | ';
if (!empty($conf->multicurrency->enabled)) print ''.$multicurrencyalreadypayedlabel.' | ';
- print ''.$remaindertopay.' | ';
if (!empty($conf->multicurrency->enabled)) print ''.$multicurrencyremaindertopay.' | ';
+ print ''.$langs->trans('AmountTTC').' | ';
+ print ''.$alreadypayedlabel.' | ';
+ print ''.$remaindertopay.' | ';
print ''.$langs->trans('PaymentAmount').' | ';
if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyPaymentAmount').' | ';
print ' | ';
@@ -624,12 +628,35 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Date
print ''.dol_print_date($db->jdate($objp->df),'day')." | \n";
-
- // Price
- print ''.price($sign * $objp->total_ttc).' | ';
-
+
+ // currency
+ print ''.$objp->multicurrency_code." | \n";
+
// Multicurrency Price
- if (!empty($conf->multicurrency->enabled)) print ''.price($sign * $objp->multicurrency_total_ttc).' | ';
+ if (!empty($conf->multicurrency->enabled))
+ {
+ print '';
+ if ($objp->multicurrency_code != $conf->currency) print price($sign * $objp->multicurrency_total_ttc);
+ print ' | ';
+
+ // Multicurrency Price
+ print '';
+ if ($objp->multicurrency_code != $conf->currency)
+ {
+ print price($sign * $multicurrency_payment);
+ if ($multicurrency_creditnotes) print '+'.price($multicurrency_creditnotes);
+ if ($multicurrency_deposits) print '+'.price($multicurrency_deposits);
+ }
+ print ' | ';
+
+ // Multicurrency Price
+ print '';
+ if ($objp->multicurrency_code != $conf->currency) print price($sign * $multicurrency_remaintopay);
+ print ' | ';
+ }
+
+ // Price
+ print ''.price($sign * $objp->total_ttc).' | ';
// Received or paid back
print ''.price($sign * $paiement);
@@ -637,25 +664,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
if ($deposits) print '+'.price($deposits);
print ' | ';
- // Multicurrency Price
- if (!empty($conf->multicurrency->enabled))
- {
- print ''.price($sign * $multicurrency_payment);
- if ($multicurrency_creditnotes) print '+'.price($multicurrency_creditnotes);
- if ($multicurrency_deposits) print '+'.price($multicurrency_deposits);
- print ' | ';
- }
-
// Remain to take or to pay back
print ''.price($sign * $remaintopay).' | ';
//$test= price(price2num($objp->total_ttc - $paiement - $creditnotes - $deposits));
- // Multicurrency Price
- if (!empty($conf->multicurrency->enabled))
- {
- print ''.price($sign * $multicurrency_remaintopay).' | ';
- }
-
// Amount
print '';
@@ -665,7 +677,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
if ($action != 'add_paiement')
{
- if(!empty($conf->global->INVOICE_AUTO_FILLJS))
+ if (!empty($conf->use_javascript_ajax))
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $remaintopay)."'");
print '';
print '';
@@ -678,7 +690,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print " | ";
// Multicurrency Price
- if (!empty($conf->multicurrency->enabled))
+ if (! empty($conf->multicurrency->enabled))
{
print '';
@@ -688,7 +700,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
if ($action != 'add_paiement')
{
- if(!empty($conf->global->INVOICE_AUTO_FILLJS))
+ if (!empty($conf->use_javascript_ajax))
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'");
print '';
print '';
@@ -727,16 +739,16 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
{
// Print total
print ' |
';
- print '| '.$langs->trans('TotalTTC').' | ';
- print ''.price($sign * $total_ttc).' | ';
+ print ''.$langs->trans('TotalTTC').' | ';
if (!empty($conf->multicurrency->enabled)) print ' | ';
+ if (!empty($conf->multicurrency->enabled)) print ' | ';
+ if (!empty($conf->multicurrency->enabled)) print ' | ';
+ print ''.price($sign * $total_ttc).' | ';
print ''.price($sign * $totalrecu);
if ($totalrecucreditnote) print '+'.price($totalrecucreditnote);
if ($totalrecudeposits) print '+'.price($totalrecudeposits);
print ' | ';
- if (!empty($conf->multicurrency->enabled)) print ' | ';
print ''.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).' | ';
- if (!empty($conf->multicurrency->enabled)) print ' | ';
print ' | ';
if (!empty($conf->multicurrency->enabled)) print ' | ';
print ' | ';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 205ed471673..a0468d0a053 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -4101,6 +4101,11 @@ class Form
$out='';
$out.= '