Skip to content
Code-Schnipsel Gruppen Projekte
Commit daaa0156 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

feat: Comment -> source and sourceIcon - customer#12

Übergeordneter 8ec4be81
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
......@@ -87,6 +87,10 @@ define('package/quiqqer/erp/bin/backend/controls/Comments', [
}
}
if (typeof entry.sourceIcon !== 'undefined' && entry.sourceIcon !== '') {
type = entry.sourceIcon;
}
return {
date : date,
time : Formatter.format(date),
......@@ -203,4 +207,4 @@ define('package/quiqqer/erp/bin/backend/controls/Comments', [
}
}
});
});
\ No newline at end of file
});
......@@ -98,9 +98,15 @@ public function toArray()
*
* @param string $message
* @param int|false $time - optional, unix timestamp
* @param string $source - optional, name of the package
* @param string $sourceIcon - optional, source icon
*/
public function addComment($message, $time = false)
{
public function addComment(
$message,
$time = false,
$source = '',
$sourceIcon = ''
) {
if ($time === false) {
$time = \time();
}
......@@ -108,8 +114,10 @@ public function addComment($message, $time = false)
$message = QUI\Utils\Security\Orthos::clearFormRequest($message);
$this->comments[] = [
'message' => $message,
'time' => (int)$time
'message' => $message,
'time' => (int)$time,
'source' => $source,
'sourceIcon' => $sourceIcon
];
}
......@@ -145,7 +153,20 @@ public function import(Comments $Comments)
$comments = $Comments->toArray();
foreach ($comments as $comment) {
$this->addComment($comment['message'], $comment['time']);
if (!isset($comment['source'])) {
$comment['source'] = '';
}
if (!isset($comment['sourceIcon'])) {
$comment['sourceIcon'] = '';
}
$this->addComment(
$comment['message'],
$comment['time'],
$comment['source'],
$comment['sourceIcon']
);
}
$this->sort();
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren