Knowledge tms (#35243)
* clean code * clean code * clean code * clean code * clean code * clean code * clean code
This commit is contained in:
parent
21d28a745f
commit
73073a5bf0
4 changed files with 23 additions and 17 deletions
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
|
||||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
|
||||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -91,8 +91,9 @@ class box_last_modified_knowledgerecord extends ModeleBoxes
|
|||
);
|
||||
|
||||
if ($user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) {
|
||||
$sql = 'SELECT k.rowid as id, k.date_creation, k.ref, k.lang, k.question, k.status as status';
|
||||
$sql = 'SELECT k.rowid as id, k.date_creation, GREATEST(k.tms, kef.tms) as date_modification, k.ref, k.lang, k.question, k.status as status';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord as k";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord_extrafields as kef ON kef.fk_object = k.rowid";
|
||||
$sql .= " WHERE k.entity IN (".getEntity('knowledgemanagement').")";
|
||||
|
||||
if ($user->socid) {
|
||||
|
|
@ -101,7 +102,7 @@ class box_last_modified_knowledgerecord extends ModeleBoxes
|
|||
|
||||
$sql .= " AND k.status > 0";
|
||||
|
||||
$sql .= " ORDER BY k.tms DESC, k.rowid DESC ";
|
||||
$sql .= " ORDER BY date_modification DESC, k.rowid DESC ";
|
||||
$sql .= $this->db->plimit($max, 0);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -114,10 +115,12 @@ class box_last_modified_knowledgerecord extends ModeleBoxes
|
|||
$objp = $this->db->fetch_object($resql);
|
||||
|
||||
$datec = $this->db->jdate($objp->date_creation);
|
||||
$datem = $this->db->jdate($objp->date_modification);
|
||||
|
||||
$knowledgerecord = new KnowledgeRecord($this->db);
|
||||
$knowledgerecord->id = $objp->id;
|
||||
$knowledgerecord->date_creation = $objp->date_creation;
|
||||
$knowledgerecord->date_modification = $objp->date_modification;
|
||||
$knowledgerecord->ref = $objp->ref;
|
||||
$knowledgerecord->status = $objp->status;
|
||||
$knowledgerecord->question = $objp->question;
|
||||
|
|
@ -151,8 +154,8 @@ class box_last_modified_knowledgerecord extends ModeleBoxes
|
|||
|
||||
// Date creation
|
||||
$this->info_box_contents[$i][$r] = array(
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateCreation").': '.dol_print_date($datec, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datec, 'dayhour', 'tzuserrel'),
|
||||
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($datem, 'dayhour', 'tzuserrel'),
|
||||
);
|
||||
$r++;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
|
|
@ -530,7 +530,7 @@ if (count($typeleaves) == 0) {
|
|||
print '</td>'."\n";
|
||||
|
||||
print '<td class="center">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/holiday/view_log.php?search_employee='.((int) $users[rowid]).'">'.img_picto($langs->trans('MenuLogCP'), 'list-alt').'</a>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/holiday/view_log.php?search_employee='.((int) $users['rowid']).'">'.img_picto($langs->trans('MenuLogCP'), 'list-alt').'</a>';
|
||||
print '</td>';
|
||||
|
||||
// Action column
|
||||
|
|
|
|||
|
|
@ -159,10 +159,12 @@ class KnowledgeRecord extends CommonObject
|
|||
* @var string
|
||||
*/
|
||||
public $url;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
* @var ?int
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
|
@ -772,7 +774,7 @@ class KnowledgeRecord extends CommonObject
|
|||
$nofetch = !empty($params['nofetch']);
|
||||
|
||||
$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("KnowledgeRecord").'</u>';
|
||||
if (isset($this->statut)) {
|
||||
if (isset($this->status)) {
|
||||
$datas['picto'] .= ' '.$this->getLibStatut(5);
|
||||
}
|
||||
$datas['label'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
|
|
@ -965,9 +967,10 @@ class KnowledgeRecord extends CommonObject
|
|||
*/
|
||||
public function info($id)
|
||||
{
|
||||
$sql = 'SELECT rowid, date_creation as datec, tms as datem,';
|
||||
$sql .= ' fk_user_creat, fk_user_modif';
|
||||
$sql = 'SELECT t.rowid, t.date_creation as datec, GREATEST(t.tms, kef.tms) as datem,';
|
||||
$sql .= ' t.fk_user_creat, t.fk_user_modif';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$this->table_element."_extrafields as kef ON kef.fk_object = t.rowid";
|
||||
$sql .= ' WHERE t.rowid = '.((int) $id);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
|
|
@ -978,7 +981,7 @@ class KnowledgeRecord extends CommonObject
|
|||
|
||||
$this->user_creation_id = $obj->fk_user_creat;
|
||||
$this->user_modification_id = $obj->fk_user_modif;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2017-2021 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -496,7 +496,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
} else {
|
||||
$langs->load("errors");
|
||||
//print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', 0);
|
||||
print '<a class="butActionRefused" href="" title="'.$langs->trans("ErrorAddAtLeastOneLineFirst").'">'.$langs->trans("Reply").'</a>';
|
||||
print '<a class="butActionRefused" href="" title="'.$langs->trans("ErrorAddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue