Page 1 of 1

Audit Trail On Inventory Notes Tab.  Topic is solved

PostPosted: Fri Oct 27, 2017 2:56 pm
by Ernst
Somebody may find this useful.. If somebody tries to delete the Notes, it save a Note that XXXX changed Notes... Gotcha..:)

On an Inventory Plugin
Under Implements add this.

Private PropertiesChanges As String
Private PriorProperty As String

Under SetupBeforehandlers add this.

AddHandler inventoryForm.Inventory.SaveStart , AddressOf Inventory_SaveStart

Under the setup Sub add this.

Private Sub Inventory_PropertyChanged(sender As Object, e As System.ComponentModel.PropertyChangedEventArgs)
If PriorProperty <> e.PropertyName Then
PropertiesChanges = PropertiesChanges & " " & e.PropertyName
End If
PriorProperty = e.PropertyName
End Sub

And add this Sub to Load your Audit Note.

Private Sub Inventory_SaveStart(sender As Object, e As System.EventArgs)
' Write Note, so we can Track changes.
Dim inventory As JiwaInventory.Inventory = sender
inventory.Notes.Add(New JiwaApplication.Notes.Note With {.NoteText = "SaveDone Items Changed:" & PropertiesChanges , .NoteType = inventory.Notes.DefaultNoteType})
PropertiesChanges = ""
End Sub

Happy Coding...:)

Re: Audit Trail On Inventory Notes Tab.

PostPosted: Sun Oct 29, 2017 4:30 pm
by Mike.Sheen
You could also create an abstract permission for the ability to delete notes, and only add that permission to user groups you want to allow delete of notes - then in a plugin throw an exception upon note delete based on that permission, which prevents the user from deleting it in the first place.

Re: Audit Trail On Inventory Notes Tab.

PostPosted: Thu Nov 02, 2017 6:27 pm
by Ernst
Good idea.