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 ''; -print ''; -print ''; -print $langs->trans("JSOnPaimentBill"); -print ''; -print $form->selectyesno("INVOICE_AUTO_FILLJS",$conf->global->INVOICE_AUTO_FILLJS,1); -print ''; -print ''; -print "\n"; -print '
'; - $var=! $var; print '
'; print ''; diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index 8ce904aad7c..93f7c301519 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -69,7 +69,7 @@ if ($action == 'setmod') dolibarr_set_const($db, "PAYMENT_ADDON",$value,'chaine',0,'',$conf->entity); } -if ($action == 'set_FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS') +if ($action == 'setparams') { $freetext = GETPOST('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS'); // No alpha here, we want exact string @@ -77,16 +77,31 @@ if ($action == 'set_FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS') if (! $res > 0) $error++; - if (! $error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else + if ($error) { setEventMessages($langs->trans("Error"), null, 'errors'); } + + /* + $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("Error"), null, 'errors'); + }*/ + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + } + /* * View */ @@ -235,6 +250,10 @@ print "
"; print load_fiche_titre($langs->trans("OtherOptions"),'',''); +print ''; +print ''; +print ''; + print ''; print ''; print ''; @@ -244,20 +263,32 @@ print "\n"; // Allow payments on different thirdparties bills but same parent company $var=! $var; -print ''; -print ''; -print ''; print '\n"; -print ''; + +// Add js auto fill amount on paiement form +/* always on now +$var=! $var; +print '\n"; +*/ print '
'.$langs->trans("Parameter").'
'; print $langs->trans("PaymentOnDifferentThirdBills"); print ''; print $form->selectyesno("FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS",$conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS,1); print ''; -print ''; print "
'; +print $langs->trans("JSOnPaimentBill"); +print ''; +print $form->selectyesno("INVOICE_AUTO_FILLJS",$conf->global->INVOICE_AUTO_FILLJS,1); +print ''; +print "
'; +print '
'; +print ''; +print '
'; + +print ''; + dol_fiche_end(); diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 4b0039c0a21..ecd7e1cecda 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $langs->load('companies'); $langs->load('bills'); $langs->load('banks'); +$langs->load('multicurrency'); $action = GETPOST('action','alpha'); $confirm = GETPOST('confirm'); @@ -433,7 +434,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie '; print ' });'."\n"; - if(!empty($conf->global->INVOICE_AUTO_FILLJS)){ + if (!empty($conf->use_javascript_ajax)){ //Add js for AutoFill print ' $(document).ready(function () {'; print ' $(".AutoFillAmout").on(\'click touchstart\', function(){ @@ -515,10 +516,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie dol_fiche_end(); + /* * List of unpaid invoices */ - $sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_total_ttc, f.type, '; + + $sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type, '; $sql.= ' f.datef as df, f.fk_soc as socid'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; @@ -572,12 +575,13 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie 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.= '