Fixed a couple issues with the audit trail changes
This commit is contained in:
parent
1a66485d48
commit
ad63bcac02
@ -3,6 +3,8 @@
|
|||||||
namespace BusinessLogic\Calendar;
|
namespace BusinessLogic\Calendar;
|
||||||
|
|
||||||
|
|
||||||
|
use BusinessLogic\Tickets\AuditTrail;
|
||||||
|
|
||||||
class CalendarEvent extends AbstractEvent {
|
class CalendarEvent extends AbstractEvent {
|
||||||
public $type = 'CALENDAR';
|
public $type = 'CALENDAR';
|
||||||
|
|
||||||
@ -18,4 +20,7 @@ class CalendarEvent extends AbstractEvent {
|
|||||||
public $reminderValue;
|
public $reminderValue;
|
||||||
|
|
||||||
public $reminderUnits;
|
public $reminderUnits;
|
||||||
|
|
||||||
|
/* @var $auditTrail AuditTrail[] */
|
||||||
|
public $auditTrail = array();
|
||||||
}
|
}
|
||||||
@ -76,23 +76,24 @@ class CalendarGateway extends CommonDao {
|
|||||||
$event->reminderUnits = $row['reminder_unit'] === null ? null : ReminderUnit::getByValue($row['reminder_unit']);
|
$event->reminderUnits = $row['reminder_unit'] === null ? null : ReminderUnit::getByValue($row['reminder_unit']);
|
||||||
|
|
||||||
$auditTrailSql = "SELECT `at`.`id` AS `id`, `at`.`entity_id`, `at`.`language_key`, `at`.`date`,
|
$auditTrailSql = "SELECT `at`.`id` AS `id`, `at`.`entity_id`, `at`.`language_key`, `at`.`date`,
|
||||||
`values`.`replacement_index`, `values`.`replacement_values`
|
`values`.`replacement_index`, `values`.`replacement_value`
|
||||||
FROM `" . hesk_dbEscape($heskSettings['db_pfix']) . "audit_trail` AS `at`
|
FROM `" . hesk_dbEscape($heskSettings['db_pfix']) . "audit_trail` AS `at`
|
||||||
INNER JOIN `" . hesk_dbEscape($heskSettings['db_pfix']) . "audit_trail_to_replacement_values` AS `values`
|
INNER JOIN `" . hesk_dbEscape($heskSettings['db_pfix']) . "audit_trail_to_replacement_values` AS `values`
|
||||||
ON `at`.`id` = `values`.`audit_trail_id`
|
ON `at`.`id` = `values`.`audit_trail_id`
|
||||||
WHERE `entity_id` = " . intval($event->id) . "
|
WHERE `entity_id` = " . intval($event->id) . "
|
||||||
AND `entity_type` = '" . AuditTrailEntityType::CALENDAR_EVENT . "'";
|
AND `entity_type` = '" . AuditTrailEntityType::CALENDAR_EVENT . "'";
|
||||||
$auditTrailRs = hesk_dbFetchAssoc($auditTrailSql);
|
$auditTrailRs = hesk_dbQuery($auditTrailSql);
|
||||||
|
/* @var $auditTrailEntry AuditTrail */
|
||||||
$auditTrailEntry = null;
|
$auditTrailEntry = null;
|
||||||
while ($row = hesk_dbFetchAssoc($rs)) {
|
while ($row = hesk_dbFetchAssoc($auditTrailRs)) {
|
||||||
if ($auditTrailEntry == null || intval($auditTrailEntry['id']) !== intval($row['id'])) {
|
if ($auditTrailEntry == null || intval($auditTrailEntry->id) !== intval($row['id'])) {
|
||||||
if ($auditTrailEntry !== null) {
|
if ($auditTrailEntry !== null) {
|
||||||
//$audit_records[] = $auditTrailEntry;
|
$event->auditTrail[] = $auditTrailEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
$auditTrailEntry = new AuditTrail();
|
$auditTrailEntry = new AuditTrail();
|
||||||
$auditTrailEntry->id = $row['id'];
|
$auditTrailEntry->id = intval($row['id']);
|
||||||
$auditTrailEntry->entityId = $row['entity_id'];
|
$auditTrailEntry->entityId = intval($row['entity_id']);
|
||||||
$auditTrailEntry->entityType = AuditTrailEntityType::CALENDAR_EVENT;
|
$auditTrailEntry->entityType = AuditTrailEntityType::CALENDAR_EVENT;
|
||||||
$auditTrailEntry->languageKey = $row['language_key'];
|
$auditTrailEntry->languageKey = $row['language_key'];
|
||||||
$auditTrailEntry->date = $row['date'];
|
$auditTrailEntry->date = $row['date'];
|
||||||
@ -102,7 +103,7 @@ class CalendarGateway extends CommonDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($auditTrailEntry !== null) {
|
if ($auditTrailEntry !== null) {
|
||||||
//$event->auditTrail[] = $audiTrailEntry;
|
$event->auditTrail[] = $auditTrailEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
$events[] = $event;
|
$events[] = $event;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user