Merge pull request #16938 from FHenry/13_fix_POST

change $_POST to GETPOST
This commit is contained in:
Laurent Destailleur 2021-03-25 01:30:08 +01:00 committed by GitHub
commit 5826d7747c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -175,10 +175,10 @@ if ($action == 'addtimespent' && $user->rights->projet->lire)
$action = 'createtime';
$error++;
} else {
$object->timespent_note = $_POST["timespent_note"];
$object->timespent_note = GETPOST('timespent_note', 'alpha');
if (GETPOST('progress', 'int') > 0) $object->progress = GETPOST('progress', 'int'); // If progress is -1 (not defined), we do not change value
$object->timespent_duration = $_POST["timespent_durationhour"] * 60 * 60; // We store duration in seconds
$object->timespent_duration += ($_POST["timespent_durationmin"] ? $_POST["timespent_durationmin"] : 0) * 60; // We store duration in seconds
$object->timespent_duration = GETPOSTINT("timespent_durationhour") * 60 * 60; // We store duration in seconds
$object->timespent_duration += (GETPOSTINT('timespent_durationmin') ? GETPOSTINT('timespent_durationmin') : 0) * 60; // We store duration in seconds
if (GETPOST("timehour") != '' && GETPOST("timehour") >= 0) // If hour was entered
{
$object->timespent_date = dol_mktime(GETPOST("timehour"), GETPOST("timemin"), 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear"));
@ -224,10 +224,10 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us
$result = $object->delTimeSpent($user);
$object->fetch($id, $ref);
$object->timespent_note = $_POST["timespent_note_line"];
$object->timespent_old_duration = $_POST["old_duration"];
$object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds
$object->timespent_duration += ($_POST["new_durationmin"] ? $_POST["new_durationmin"] : 0) * 60; // We store duration in seconds
$object->timespent_note = GETPOST('timespent_note_line', 'alpha');
$object->timespent_old_duration = GETPOST("old_duration");
$object->timespent_duration = GETPOSTINT("new_durationhour") * 60 * 60; // We store duration in seconds
$object->timespent_duration += (GETPOSTINT("new_durationmin") ? GETPOSTINT('new_durationmin') : 0) * 60; // We store duration in seconds
if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered
{
$object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear"));
@ -248,11 +248,11 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us
$object->fetch($id, $ref);
// TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids))
$object->timespent_id = $_POST["lineid"];
$object->timespent_note = $_POST["timespent_note_line"];
$object->timespent_old_duration = $_POST["old_duration"];
$object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds
$object->timespent_duration += ($_POST["new_durationmin"] ? $_POST["new_durationmin"] : 0) * 60; // We store duration in seconds
$object->timespent_id = GETPOST("lineid", 'int');
$object->timespent_note = GETPOST('timespent_note_line', 'alpha');
$object->timespent_old_duration = GETPOST("old_duration");
$object->timespent_duration = GETPOSTINT("new_durationhour") * 60 * 60; // We store duration in seconds
$object->timespent_duration += (GETPOSTINT("new_durationmin") ? GETPOSTINT('new_durationmin') : 0) * 60; // We store duration in seconds
if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered
{
$object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear"));
@ -260,7 +260,7 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us
} else {
$object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear"));
}
$object->timespent_fk_user = $_POST["userid_line"];
$object->timespent_fk_user = GETPOST("userid_line", 'int');
$result = $object->updateTimeSpent($user);
if ($result >= 0)