From e392697f0c650b8ca663d29e6cdbb94c236f91e9 Mon Sep 17 00:00:00 2001 From: Gabriel Ardean Date: Mon, 12 Jun 2023 17:43:59 +0200 Subject: [PATCH] #8 Add app ID information --- ...dd_column_app_id_to_table_modelhistory.php | 25 +++++++++++++++++++ src/managers/BaseManager.php | 1 + src/messages/it-IT/arh.php | 1 + .../active-record-history/model-changes.php | 4 +++ 4 files changed, 31 insertions(+) create mode 100644 migrations/m230612_142900_add_column_app_id_to_table_modelhistory.php diff --git a/migrations/m230612_142900_add_column_app_id_to_table_modelhistory.php b/migrations/m230612_142900_add_column_app_id_to_table_modelhistory.php new file mode 100644 index 0000000..d1aa6d1 --- /dev/null +++ b/migrations/m230612_142900_add_column_app_id_to_table_modelhistory.php @@ -0,0 +1,25 @@ +addColumn('modelhistory', 'app_id', $this->string(25)); + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $this->dropColumn('modelhistory', 'app_id'); + } +} diff --git a/src/managers/BaseManager.php b/src/managers/BaseManager.php index 988e6fe..dd2f900 100644 --- a/src/managers/BaseManager.php +++ b/src/managers/BaseManager.php @@ -70,6 +70,7 @@ public function run($type, $object) 'type' => $type, 'date' => date('Y-m-d H:i:s', time()), 'action' => Yii::$app->requestedRoute, + 'app_id' => Yii::$app->id, ]; if ($this->saveUserId) diff --git a/src/messages/it-IT/arh.php b/src/messages/it-IT/arh.php index 36a3610..070f937 100644 --- a/src/messages/it-IT/arh.php +++ b/src/messages/it-IT/arh.php @@ -14,4 +14,5 @@ 'Update' => 'Modifica', 'Update ID' => 'Modifica ID', 'Delete' => 'Cancellazione', + 'Application' => 'Applicazione', ]; \ No newline at end of file diff --git a/src/views/active-record-history/model-changes.php b/src/views/active-record-history/model-changes.php index 65430f2..f198ffc 100644 --- a/src/views/active-record-history/model-changes.php +++ b/src/views/active-record-history/model-changes.php @@ -77,6 +77,10 @@ 'attribute' => 'action', 'label' => Yii::t('arh', 'Action'), ], + 'app_id' => [ + 'attribute' => 'app_id', + 'label' => Yii::t('arh', 'App ID'), + ], ]; if($module->changesHistoryColumns) {