diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php
index 008721ef018..5a36fc91390 100644
--- a/htdocs/compta/paiement.php
+++ b/htdocs/compta/paiement.php
@@ -374,19 +374,15 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
});
';
- // Add user helper to input amount on invoices
- if (! empty($conf->global->MAIN_JS_ON_PAYMENT) && $facture->type != 2)
- {
- print ' $("#payment_form").find("img").click(function() {
- callForResult(jQuery(this).attr("id"));
- });
-
- $("#amountpayment").change(function() {
- callForResult();
- });';
- }
-
print ' });'."\n";
+ if(!empty($conf->global->FAC_AUTO_FILLJS)){
+ //Add js for AutoFill
+ print ' $(document).ready(function () {';
+ print ' $(".AutoFillAmout").on(\'click touchstart\', function(){
+ $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value"));
+ });';
+ print ' });'."\n";
+ }
print ' '."\n";
}
@@ -412,7 +408,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '
'.$langs->trans('Comments').' | ';
$rowspan=5;
- if ($conf->use_javascript_ajax && !empty($conf->global->MAIN_JS_ON_PAYMENT)) $rowspan++;
// Payment mode
print '| '.$langs->trans('PaymentMode').' | ';
@@ -438,24 +433,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
}
print " |
\n";
- // Payment amount
- if ($conf->use_javascript_ajax && !empty($conf->global->MAIN_JS_ON_PAYMENT))
- {
- print '| '.$langs->trans('AmountPayment').' | ';
- print '';
- if ($action == 'add_paiement')
- {
- print '';
- print '';
- }
- else
- {
- print '';
- }
- print ' | ';
- print '
';
- }
-
// Cheque number
print ''.$langs->trans('Numero');
print ' ('.$langs->trans("ChequeOrTransferNumber").')';
@@ -578,10 +555,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
if ($action != 'add_paiement')
{
- if ($conf->use_javascript_ajax && !empty($conf->global->MAIN_JS_ON_PAYMENT))
- {
- print img_picto($langs->trans('AddRemind'),'rightarrow.png','id="'.$objp->facid.'"');
- }
+ if(!empty($conf->global->FAC_AUTO_FILLJS))
+ print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $remaintopay)."'");
print '';
print '';
}
diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php
index 953348dbb49..bc208421fce 100644
--- a/htdocs/fourn/facture/paiement.php
+++ b/htdocs/fourn/facture/paiement.php
@@ -332,7 +332,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print $langs->trans('Invoices').' ';
if(!empty($conf->global->FAC_AUTO_FILLJS)){
- //Addjs for AutoFill
+ //Add js for AutoFill
print "\n".' |