Update card.php
This commit is contained in:
parent
1cc7b41de3
commit
6c3ecc600d
@ -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,23 +153,21 @@ 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 {
|
||||||
$object->type = $actioncode;
|
$object->type = $actioncode;
|
||||||
$object->label = GETPOST('label', 'alpha');
|
$object->label = GETPOST('label', 'alpha');
|
||||||
$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)
|
||||||
{
|
{
|
||||||
@ -203,12 +199,11 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->cre
|
|||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
$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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user