Working on audit for API, trying to fix email issues
parent
c6f4e4ce3e
commit
7e6a5b2ba5
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic;
|
||||||
|
|
||||||
|
|
||||||
|
class DateTimeHelpers {
|
||||||
|
static function heskDate($heskSettings, $dt = '', $isStr = true, $return_str = true) {
|
||||||
|
|
||||||
|
if (!$dt) {
|
||||||
|
$dt = time();
|
||||||
|
} elseif ($isStr) {
|
||||||
|
$dt = strtotime($dt);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return formatted date
|
||||||
|
return $return_str ? date($heskSettings['timeformat'], $dt) : $dt;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DataAccess\AuditTrail;
|
||||||
|
|
||||||
|
|
||||||
|
use DataAccess\CommonDao;
|
||||||
|
|
||||||
|
class AuditTrailGateway extends CommonDao {
|
||||||
|
function insertAuditTrailRecord($entityId, $entityType, $languageKey, $date, $replacementValues, $heskSettings) {
|
||||||
|
$this->init();
|
||||||
|
|
||||||
|
hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($heskSettings['db_pfix']) . "audit_trail` (`entity_id`, `entity_type`,
|
||||||
|
`language_key`, `date`) VALUES (" . intval($entityId) . ", '" . hesk_dbEscape($entityType) . "',
|
||||||
|
'" . hesk_dbEscape($languageKey) . "', '" . hesk_dbEscape($date) . "')");
|
||||||
|
|
||||||
|
$auditId = hesk_dbInsertID();
|
||||||
|
|
||||||
|
foreach ($replacementValues as $replacementIndex => $replacementValue) {
|
||||||
|
hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($heskSettings['db_pfix']) . "audit_trail_to_replacement_values`
|
||||||
|
(`audit_trail_id`, `replacement_index`, `replacement_value`) VALUES (" . intval($auditId) . ",
|
||||||
|
" . intval($replacementIndex) . ", '" . hesk_dbEscape($replacementValue) . "')");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->close();
|
||||||
|
|
||||||
|
return $auditId;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue