Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2020-11-04 20:35:36 +01:00
commit 8d84f7437b
2 changed files with 14 additions and 20 deletions

View File

@ -30,8 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
if (!empty($conf->projet->enabled)) if (!empty($conf->projet->enabled)) {
{
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
} }
@ -124,8 +123,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes')
{ {
$object->fetch($id); $object->fetch($id);
$result = $object->delete($user); $result = $object->delete($user);
if ($result > 0) if ($result > 0) {
{
header("Location: list.php"); header("Location: list.php");
exit; exit;
} else { } else {
@ -137,7 +135,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes')
// Add social contribution // Add social contribution
if ($action == 'add' && $user->rights->tax->charges->creer) if ($action == 'add' && $user->rights->tax->charges->creer)
{ {
$amount = price2num(GETPOST('amount')); $amount = price2num(GETPOST('amount'), 'MT');
if (!$dateech) if (!$dateech)
{ {
@ -155,8 +153,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
{ {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
$action = 'create'; $action = 'create';
} elseif (!is_numeric($amount)) } elseif (!is_numeric($amount)) {
{
setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors');
$action = 'create'; $action = 'create';
} else { } else {
@ -165,13 +162,12 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
$object->date_ech = $dateech; $object->date_ech = $dateech;
$object->periode = $dateperiod; $object->periode = $dateperiod;
$object->amount = $amount; $object->amount = $amount;
$object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->mode_reglement_id = (int) GETPOST('mode_reglement_id', 'int');
$object->fk_account = GETPOST('fk_account', 'int'); $object->fk_account = (int) GETPOST('fk_account', 'int');
$object->fk_project = GETPOST('fk_project'); $object->fk_project = (int) GETPOST('fk_project', 'int');
$id = $object->create($user); $id = $object->create($user);
if ($id <= 0) if ($id <= 0) {
{
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$action = 'create'; $action = 'create';
} }
@ -181,7 +177,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->creer) if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->creer)
{ {
$amount = price2num(GETPOST('amount')); $amount = price2num(GETPOST('amount'), 'MT');
if (!$dateech) if (!$dateech)
{ {
@ -204,11 +200,10 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->cre
$object->date_ech = $dateech; $object->date_ech = $dateech;
$object->periode = $dateperiod; $object->periode = $dateperiod;
$object->amount = price2num($amount); $object->amount = $amount;
$result = $object->update($user); $result = $object->update($user);
if ($result <= 0) if ($result <= 0) {
{
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }

View File

@ -93,7 +93,6 @@ $search_btn = GETPOST('button_search', 'alpha');
$search_remove_btn = GETPOST('button_removefilter', 'alpha'); $search_remove_btn = GETPOST('button_removefilter', 'alpha');
$status = GETPOST('statut', 'alpha'); $status = GETPOST('statut', 'alpha');
$search_status = GETPOST('search_status');
// Security check // Security check
$orderid = GETPOST('orderid', 'int'); $orderid = GETPOST('orderid', 'int');