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

This commit is contained in:
Laurent Destailleur 2021-03-26 01:37:37 +01:00
commit e2b02726a7
3 changed files with 70 additions and 64 deletions

View File

@ -303,7 +303,9 @@ if (empty($reshook)) {
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object); $ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) $error++; if ($ret < 0) {
$error++;
}
// Check if we need to also synchronize user information // Check if we need to also synchronize user information
$nosyncuser = 0; $nosyncuser = 0;
@ -317,6 +319,7 @@ if (empty($reshook)) {
if ($user->id != $object->user_id && empty($user->rights->user->user->password)) $nosyncuserpass = 1; // Disable synchronizing if ($user->id != $object->user_id && empty($user->rights->user->user->password)) $nosyncuserpass = 1; // Disable synchronizing
} }
if (!$error) {
$result = $object->update($user, 0, $nosyncuser, $nosyncuserpass); $result = $object->update($user, 0, $nosyncuser, $nosyncuserpass);
if ($result >= 0 && !count($object->errors)) { if ($result >= 0 && !count($object->errors)) {
@ -377,6 +380,9 @@ if (empty($reshook)) {
} else { } else {
$action = 'edit'; $action = 'edit';
} }
} else {
$action = 'edit';
}
} }
if ($action == 'add' && $user->rights->adherent->creer) { if ($action == 'add' && $user->rights->adherent->creer) {

View File

@ -474,7 +474,7 @@ class FormOther
//Add hook to filter on user (for exemple on usergroup define in custom modules) //Add hook to filter on user (for exemple on usergroup define in custom modules)
if (!empty($reshook)) $sql_usr .= $hookmanager->resArray[1]; if (!empty($reshook)) $sql_usr .= $hookmanager->resArray[1];
} }
$sql_usr .= " ORDER BY statut DESC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION. $sql_usr .= " ORDER BY status DESC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION.
//print $sql_usr;exit; //print $sql_usr;exit;
$resql_usr = $this->db->query($sql_usr); $resql_usr = $this->db->query($sql_usr);

View File

@ -175,10 +175,10 @@ if ($action == 'addtimespent' && $user->rights->projet->lire)
$action = 'createtime'; $action = 'createtime';
$error++; $error++;
} else { } 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 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 = GETPOSTINT("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_durationmin') ? GETPOSTINT('timespent_durationmin') : 0) * 60; // We store duration in seconds
if (GETPOST("timehour") != '' && GETPOST("timehour") >= 0) // If hour was entered 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")); $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); $result = $object->delTimeSpent($user);
$object->fetch($id, $ref); $object->fetch($id, $ref);
$object->timespent_note = $_POST["timespent_note_line"]; $object->timespent_note = GETPOST('timespent_note_line', 'alpha');
$object->timespent_old_duration = $_POST["old_duration"]; $object->timespent_old_duration = GETPOST("old_duration");
$object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds $object->timespent_duration = GETPOSTINT("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_duration += (GETPOSTINT("new_durationmin") ? GETPOSTINT('new_durationmin') : 0) * 60; // We store duration in seconds
if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered 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")); $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); $object->fetch($id, $ref);
// TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids))
$object->timespent_id = $_POST["lineid"]; $object->timespent_id = GETPOST("lineid", 'int');
$object->timespent_note = $_POST["timespent_note_line"]; $object->timespent_note = GETPOST('timespent_note_line', 'alpha');
$object->timespent_old_duration = $_POST["old_duration"]; $object->timespent_old_duration = GETPOST("old_duration");
$object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds $object->timespent_duration = GETPOSTINT("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_duration += (GETPOSTINT("new_durationmin") ? GETPOSTINT('new_durationmin') : 0) * 60; // We store duration in seconds
if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered 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")); $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 { } else {
$object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); $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); $result = $object->updateTimeSpent($user);
if ($result >= 0) if ($result >= 0)