diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index b66e10c0f71..3bcea99dc39 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -638,7 +638,7 @@ if (empty($reshook)) {
}
$newcardbutton .= ''.$langs->trans("IncludeDocsAlreadyExported").'';
- $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export);
+ if (!empty($user->rights->accounting->mouvements->export)) $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export);
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php
index a94a78a9794..4ed21144346 100644
--- a/htdocs/admin/system/filecheck.php
+++ b/htdocs/admin/system/filecheck.php
@@ -264,7 +264,7 @@ if (!$error && $xml)
$out .= "\n";
}
} else {
- $out .= '
| '.$langs->trans("None").' |
';
+ $out .= '| '.$langs->trans("None").' |
';
}
$out .= '';
$out .= '';
@@ -317,7 +317,7 @@ if (!$error && $xml)
$out .= ' | '."\n";
$out .= "\n";
} else {
- $out .= '| '.$langs->trans("None").' |
';
+ $out .= '| '.$langs->trans("None").' |
';
}
$out .= '';
$out .= '';
@@ -370,12 +370,11 @@ if (!$error && $xml)
$out .= ' | '."\n";
$out .= "\n";
} else {
- $out .= '| '.$langs->trans("None").' |
';
+ $out .= '| '.$langs->trans("None").' |
';
}
$out .= '';
$out .= '';
-
// Show warning
if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3))
{
diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index 38e8b601cf6..47f1d336279 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -134,10 +134,10 @@ if (empty($reshook))
// Set if we used free entry or predefined product
$idprod = (int) GETPOST('idprod', 'int');
- $qty = GETPOST('qty', 'int');
- $qty_frozen = GETPOST('qty_frozen', 'int');
+ $qty = price2num(GETPOST('qty', 'alpha'), 'MS');
+ $qty_frozen = price2num(GETPOST('qty_frozen', 'alpha'), 'MS');
$disable_stock_change = GETPOST('disable_stock_change', 'int');
- $efficiency = GETPOST('efficiency', 'int');
+ $efficiency = price2num(GETPOST('efficiency', 'alpha'));
if ($qty == '') {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
@@ -155,8 +155,6 @@ if (empty($reshook))
if (!$error)
{
- $lastposition = 0;
-
$bomline = new BOMLine($db);
$bomline->fk_bom = $id;
$bomline->fk_product = $idprod;
@@ -195,10 +193,10 @@ if (empty($reshook))
$error = 0;
// Set if we used free entry or predefined product
- $qty = price2num(GETPOST('qty', 'int'));
- $qty_frozen = GETPOST('qty_frozen', 'int');
+ $qty = price2num(GETPOST('qty', 'alpha'), 'MS');
+ $qty_frozen = price2num(GETPOST('qty_frozen', 'alpha'), 'MS');
$disable_stock_change = GETPOST('disable_stock_change', 'int');
- $efficiency = price2num(GETPOST('efficiency', 'int'));
+ $efficiency = price2num(GETPOST('efficiency', 'alpha'));
if ($qty == '') {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 12146179db0..997a5848434 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -809,7 +809,7 @@ if (empty($reshook))
$tva_tx = '';
}
- $qty = price2num(GETPOST('qty'.$predef), 'MS');
+ $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = GETPOST('remise_percent'.$predef);
if (empty($remise_percent)) $remise_percent = 0;
@@ -1234,7 +1234,7 @@ if (empty($reshook))
}
}
- $qty = price2num(GETPOST('qty'), 'MS');
+ $qty = price2num(GETPOST('qty', 'alpha'), 'MS');
$result = $object->updateline(GETPOST('lineid', 'int'), $pu_ht, $qty, GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, $_POST["units"], $pu_ht_devise);
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 2ea5c37bf39..b06acda7105 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -633,7 +633,7 @@ if (empty($reshook))
$predef = '';
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
$price_ht = price2num(GETPOST('price_ht'), 'MU');
- $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CR');
+ $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU');
$prod_entry_mode = GETPOST('prod_entry_mode');
if ($prod_entry_mode == 'free')
{
@@ -644,7 +644,7 @@ if (empty($reshook))
$tva_tx = '';
}
- $qty = price2num(GETPOST('qty'.$predef, 'alpha'));
+ $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha')) : 0);
// Extrafields
diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php
index 0efe367089c..0c2db362e75 100644
--- a/htdocs/compta/bank/various_payment/card.php
+++ b/htdocs/compta/bank/various_payment/card.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2017-2021 Alexandre Spangaro
* Copyright (C) 2018-2020 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
@@ -266,6 +266,18 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->banque->m
$object->datev = $newdatepayment;
}
+ if (GETPOSTISSET("clone_sens")) {
+ $object->sens = GETPOST("clone_sens", 'int');
+ } else {
+ $object->sens = $object->sens;
+ }
+
+ if (GETPOST("clone_amount", "alpha")) {
+ $object->amount = price2num(GETPOST("clone_amount", "alpha"));
+ } else {
+ $object->amount = price2num($object->amount);
+ }
+
if ($object->check())
{
$id = $object->create($user);
@@ -486,14 +498,19 @@ if ($id)
// Clone confirmation
if ($action === 'clone')
{
+ $set_value_help = $form->textwithpicto('', $langs->trans($langs->trans("AccountingDirectionHelp")));
+ $sensarray = array('0' => $langs->trans("Debit"), '1' => $langs->trans("Credit"));
+
$formquestion = array(
array('type' => 'text', 'name' => 'clone_label', 'label' => $langs->trans("Label"), 'value' => $langs->trans("CopyOf").' '.$object->label),
- );
- $formquestion[] = array('type' => 'date', 'tdclass'=>'fieldrequired', 'name' => 'clone_date_payment', 'label' => $langs->trans("DatePayment"), 'value' => -1);
- $formquestion[] = array('type' => 'date', 'name' => 'clone_date_value', 'label' => $langs->trans("DateValue"), 'value' => -1);
- $formquestion[] = array('type' => 'other', 'tdclass'=>'fieldrequired', 'name' => 'accountid', 'label' => $langs->trans("BankAccount"), 'value' => $form->select_comptes($accountid, "accountid", 0, '', 1, '', 0, 'minwidth200', 1));
+ array('type' => 'date', 'tdclass'=>'fieldrequired', 'name' => 'clone_date_payment', 'label' => $langs->trans("DatePayment"), 'value' => -1),
+ array('type' => 'date', 'name' => 'clone_date_value', 'label' => $langs->trans("DateValue"), 'value' => -1),
+ array('type' => 'other', 'tdclass'=>'fieldrequired', 'name' => 'clone_accountid', 'label' => $langs->trans("BankAccount"), 'value' => $form->select_comptes($object->fk_account, "accountid", 0, '', 1, '', 0, 'minwidth200', 1)),
+ array('type' => 'text', 'name' => 'clone_amount', 'label' => $langs->trans("Amount"), 'value' => price($object->amount)),
+ array('type' => 'select', 'name' => 'clone_sens', 'label' => $langs->trans("Sens") . ' ' . $set_value_help, 'values' => $sensarray, 'default' => $object->sens),
+ );
- print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 300);
+ print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350);
}
print dol_get_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto);
diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php
index 097585dbea0..64b00aaa156 100644
--- a/htdocs/compta/facture/card-rec.php
+++ b/htdocs/compta/facture/card-rec.php
@@ -439,7 +439,7 @@ if (empty($reshook))
$predef = '';
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
$price_ht = price2num(GETPOST('price_ht'), 'MU');
- $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CR');
+ $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU');
$prod_entry_mode = GETPOST('prod_entry_mode', 'alpha');
if ($prod_entry_mode == 'free')
{
@@ -450,7 +450,7 @@ if (empty($reshook))
$tva_tx = '';
}
- $qty = price2num(GETPOST('qty'.$predef), 'alpha');
+ $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = GETPOST('remise_percent'.$predef);
// Extrafields
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index d9c272df559..1f5e0456937 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -984,39 +984,39 @@ if (empty($reshook))
$action = 'create';
}
- if (!($_POST['fac_replacement'] > 0)) {
+ if (!(GETPOST('fac_replacement', 'int') > 0)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), null, 'errors');
$action = 'create';
}
- $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
+ $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
if (!$error) {
// This is a replacement invoice
- $result = $object->fetch($_POST['fac_replacement']);
+ $result = $object->fetch(GETPOST('fac_replacement', 'int'));
$object->fetch_thirdparty();
$object->date = $dateinvoice;
$object->date_pointoftax = $date_pointoftax;
$object->note_public = trim(GETPOST('note_public', 'restricthtml'));
// We do not copy the private note
- $object->ref_client = $_POST['ref_client'];
- $object->ref_int = $_POST['ref_int'];
- $object->model_pdf = $_POST['model'];
- $object->fk_project = $_POST['projectid'];
- $object->cond_reglement_id = $_POST['cond_reglement_id'];
- $object->mode_reglement_id = $_POST['mode_reglement_id'];
+ $object->ref_client = GETPOST('ref_client');
+ //$object->ref_int = $_POST['ref_int'];
+ $object->model_pdf = GETPOST('model');
+ $object->fk_project = GETPOST('projectid', 'int');
+ $object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
+ $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->fk_account = GETPOST('fk_account', 'int');
- $object->remise_absolue = $_POST['remise_absolue'];
- $object->remise_percent = $_POST['remise_percent'];
+ $object->remise_absolue = GETPOST('remise_absolue', 'alpha');
+ $object->remise_percent = GETPOST('remise_percent', 'alpha');
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
// Proprietes particulieres a facture de remplacement
- $object->fk_facture_source = $_POST['fac_replacement'];
+ $object->fk_facture_source = GETPOST('fac_replacement', 'int');
$object->type = Facture::TYPE_REPLACEMENT;
$id = $object->createFromCurrent($user);
@@ -1732,9 +1732,9 @@ if (empty($reshook))
setEventMessages($mesg, null, 'errors');
}
- $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
+ $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
- if (!($_POST['situations'] > 0)) {
+ if (!(GETPOST('situations', 'int') > 0)) {
$error++;
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation"));
setEventMessages($mesg, null, 'errors');
@@ -1742,8 +1742,8 @@ if (empty($reshook))
}
if (!$error) {
- $result = $object->fetch($_POST['situations']);
- $object->fk_facture_source = $_POST['situations'];
+ $result = $object->fetch(GETPOST('situations', 'int'));
+ $object->fk_facture_source = GETPOST('situations', 'int');
$object->type = Facture::TYPE_SITUATION;
if (!empty($origin) && !empty($originid))
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 9ec2e04ee5c..a346d955f14 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -385,7 +385,7 @@ if (empty($reshook))
$predef = '';
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
$price_ht = price2num(GETPOST('price_ht'), 'MU');
- $price_ht_devise = price2num(GETPOST('multicurrency_price_ht', 'CR'));
+ $price_ht_devise = price2num(GETPOST('multicurrency_price_ht', 'CU'));
if (GETPOST('prod_entry_mode', 'alpha') == 'free')
{
$idprod = 0;
@@ -395,7 +395,7 @@ if (empty($reshook))
$tva_tx = '';
}
- $qty = price2num(GETPOST('qty'.$predef), 'alpha');
+ $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = ((GETPOST('remise_percent'.$predef) != '') ? GETPOST('remise_percent'.$predef) : 0);
if ($qty == '')
diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php
index 983bb75cbc3..71c750c3e73 100644
--- a/htdocs/core/boxes/box_graph_invoices_permonth.php
+++ b/htdocs/core/boxes/box_graph_invoices_permonth.php
@@ -120,7 +120,8 @@ class box_graph_invoices_permonth extends ModeleBoxes
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
$nowarray = dol_getdate(dol_now(), true);
if (empty($endyear)) $endyear = $nowarray['year'];
- $startyear = $endyear - 1;
+ $startyear = $endyear - (empty($conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH) ? 1 : $conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH);
+
$mode = 'customer';
$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320';
$HEIGHT = '192';
diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php
index 1490f5ea6e9..e249900afab 100644
--- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php
+++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php
@@ -117,7 +117,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
$nowarray = dol_getdate(dol_now(), true);
if (empty($endyear)) $endyear = $nowarray['year'];
- $startyear = $endyear - 1;
+ $startyear = $endyear - (empty($conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH) ? 1 : $conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH);
+
$mode = 'supplier';
$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320';
$HEIGHT = '192';
diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php
index d9c26620553..df6a9f5c18e 100644
--- a/htdocs/core/boxes/box_graph_orders_permonth.php
+++ b/htdocs/core/boxes/box_graph_orders_permonth.php
@@ -120,7 +120,8 @@ class box_graph_orders_permonth extends ModeleBoxes
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
$nowarray = dol_getdate(dol_now(), true);
if (empty($endyear)) $endyear = $nowarray['year'];
- $startyear = $endyear - 1;
+ $startyear = $endyear - (empty($conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH) ? 1 : $conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH);
+
$mode = 'customer';
$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320';
$HEIGHT = '192';
diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php
index 765c6324516..eda3d32f250 100644
--- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php
+++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php
@@ -119,7 +119,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
$nowarray = dol_getdate(dol_now(), true);
if (empty($endyear)) $endyear = $nowarray['year'];
- $startyear = $endyear - 1;
+ $startyear = $endyear - (empty($conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH) ? 1 : $conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH);
+
$mode = 'supplier';
$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320';
$HEIGHT = '192';
diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php
index de1a1f8de83..7ca9740d8e5 100644
--- a/htdocs/core/boxes/box_graph_propales_permonth.php
+++ b/htdocs/core/boxes/box_graph_propales_permonth.php
@@ -120,7 +120,8 @@ class box_graph_propales_permonth extends ModeleBoxes
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
$nowarray = dol_getdate(dol_now(), true);
if (empty($endyear)) $endyear = $nowarray['year'];
- $startyear = $endyear - 1;
+ $startyear = $endyear - (empty($conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH) ? 1 : $conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH);
+
$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320';
$HEIGHT = '192';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 2b5b91dbf07..892c3cbfd2e 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -4882,7 +4882,7 @@ class Form
print '