Bug 107839 - BeforeUpdating and AfterUpdating events are not firing when records are edited in a Table Control
Summary: BeforeUpdating and AfterUpdating events are not firing when records are edite...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-14 05:08 UTC by Howard Johnson
Modified: 2019-12-07 07:59 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Embedded example to demonstrate this issue (12.20 KB, application/vnd.oasis.opendocument.database)
2017-05-14 05:08 UTC, Howard Johnson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Howard Johnson 2017-05-14 05:08:25 UTC
Created attachment 133306 [details]
Embedded example to demonstrate this issue

In a Table Control, in a Base Form, when a record is edited and then any record motion occurs (i.e. the cursor is moved up or down a line which saves the record to the database), I would expect that the BeforeUpdating event would fire.  

Instead BeforeUpdating fires only when the form is closed which isn't right either.


This is an important event that can be used to ensure records are entered correctly.  (In my case I want to fill an entry with a computed value if it happens to be null, before the record is saved.)


In the example database provide, the attached .odb will beep the speaker when the event fires using this Basic code:

Private Sub BeforeUpdating(oEvent As Object)
	Beep
End Sub


I can also confirm that the record actually does get changed in a similar form, in which the form is connected to a MariaDB database.  The record gets updated but no event fires.


The AfterUpdating has a similar issue.
Comment 1 Buovjaga 2017-05-14 12:25:05 UTC
Beep makes no sound for me (tested), so I changed it to MsgBox "Hello World"

I don't get the message boxes when editing, but I do get them all when I close the form window. Is this incorrect?

Arch Linux 64-bit, KDE Plasma 5
Version: 5.4.0.0.alpha1+
Build ID: c0968aa4673a8ac9a8a09a0e291b58b94bdbb35e
CPU threads: 8; OS: Linux 4.10; UI render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Built on May 13th 2016
Comment 2 Howard Johnson 2017-05-14 14:41:15 UTC
Hi,

"Beep makes no sound for me (tested)" Correct.  But it should beep when record is updated.

And you should not get an event when the window closes, unless it needs to save the record before doing so.
Comment 3 Alex Thurgood 2017-05-15 07:31:55 UTC
Not a new problem though, I can reproduce this with OOo 320m18 (OOo321) on OSX 10.12.4.

The sound is only activated when the form is closed.
Comment 4 Alex Thurgood 2017-05-15 07:33:15 UTC
Might even be a duplicate of an already known bug given that it is inherited from OOo.
Comment 5 Alex Thurgood 2017-05-15 07:39:18 UTC
This bug ties in with the synchronisation of events bug in bug 91879, which would appear to be the first report of this behaviour. I would be inclined to mark this bug as a duplicate of bug 91879.
Comment 6 Alex Thurgood 2017-05-15 07:42:41 UTC
Reproduced with

Version: 5.3.2.2
Build ID: 6cd4f1ef626f15116896b1d8e1398b56da0d0ee1
Threads CPU : 8; Version de l'OS :Mac OS X 10.12.4; UI Render : par défaut; Moteur de mise en page : nouveau; 
Locale : fr-FR (fr_FR.UTF-8); Calc: group
Comment 7 Alex Thurgood 2017-05-15 07:47:12 UTC
Hmm, given that bug 91879 has several problems, probably best to keep this separate and just reference it instead under "see also".
Comment 8 Howard Johnson 2017-12-05 18:32:52 UTC
WORKAROUND: To detect record edits use `After Record Action` in the form's underlying record.  This workaround comes from Jim K. here: 

https://ask.libreoffice.org/en/question/139867/base-any-workarounds-for-tables-broken-afterupdating-beforeupdating-events/

`After Record Action` fires when any record addition, deletion, or update is made. 

`After Record Change`, fires when any record *motion* occurs, i.e. moving from one record to another.

NOTE: This does not answer the original question here as to why or what the `After Updating` event does, or does not do.
Comment 9 QA Administrators 2018-12-06 03:57:42 UTC Comment hidden (obsolete)
Comment 10 Alex Thurgood 2018-12-06 11:31:15 UTC
Still present with

Version: 6.2.0.0.alpha1+
Build ID: 740b99783b5480fcd1e5fce7c1beb5967d015041
CPU threads: 8; OS: Mac OS X 10.14; UI render: default; VCL: osx; 
Locale: fr-FR (fr_FR.UTF-8); Calc: threaded
Comment 11 QA Administrators 2019-12-07 03:43:48 UTC Comment hidden (obsolete)
Comment 12 Robert Großkopf 2019-12-07 07:59:13 UTC
Bug still exists with LO 6.4.0.0beta1 on OpenSUSE 15.1 64bit rpm Linux