feat: update fields and date format display

This commit is contained in:
yannis 2025-06-27 15:46:01 +02:00
parent d3ac2ed53b
commit dc01e804fa
2 changed files with 14 additions and 6 deletions

View file

@ -208,7 +208,7 @@ if (empty($reshook)) {
dol_print_error($db);
}
$token->rights = $newrigths;
$reloadtoken = true;
}
if ($action == 'delrights' && $caneditperms && $confirm == 'yes') {
@ -232,7 +232,7 @@ if (empty($reshook)) {
dol_print_error($db);
}
$token->rights = $newrigths;
$reloadtoken = true;
}
if ($action == 'add') {
@ -277,6 +277,14 @@ if (empty($reshook)) {
}
}
if (isset($reloadtoken)) { // If we add or del rights, we want to refresh the token with its new updated fields
$sql = "SELECT ot.rowid as token_id, ot.token, ot.entity, ot.state as rights, ot.datec as date_creation, ot.tms as date_modification";
$sql .= " FROM ".MAIN_DB_PREFIX."oauth_token as ot";
$sql .= " WHERE ot.rowid = ".((int) $tokenid);
$resql = $db->query($sql);
$token = $db->fetch_object($resql);
}
/*
* View
@ -393,14 +401,14 @@ if ($action == 'create') {
// Creation date
print '<tr><td class="titlefield">'.$langs->trans("DateCreation").'</td>';
print '<td>';
print $token->date_creation;
print dol_print_date($db->jdate($token->date_creation), 'day');
print '</td>';
print '</tr>'."\n";
// Modification date
print '<tr><td class="titlefield">'.$langs->trans("DateModification").'</td>';
print '<td>';
print $token->date_modification;
print dol_print_date($db->jdate($token->date_modification), 'day');
print '</td>';
print '</tr>'."\n";

View file

@ -472,10 +472,10 @@ if (empty($reshook)) {
print $numperms;
print '</td>';
print '<td class="center">';
print $obj->date_creation;
print dol_print_date($db->jdate($obj->date_creation), 'day');
print '</td>';
print '<td class="center">';
print $obj->date_modification;
print dol_print_date($db->jdate($obj->date_modification), 'day');
print '</td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';