Bug 108224 - Insert -> Field -> Author puts "DocInformation:Created" field instead of "Author"
Summary: Insert -> Field -> Author puts "DocInformation:Created" field instead of "Aut...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard: target:6.1.0
Keywords:
Depends on:
Blocks: Fields Writer-Menus
  Show dependency treegraph
 
Reported: 2017-05-29 14:26 UTC by Gabriele Ponzo
Modified: 2020-02-04 11:08 UTC (History)
11 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gabriele Ponzo 2017-05-29 14:26:19 UTC
Description:
It looks like the "Author" field recalled from Insert -> Field menu is different from the real "Author" field inserted from Insert -> Field -> More fields (CTRL + F12)

Steps to Reproduce:
1. Open Writer
2. Click on Menu Insert -> Fields -> Author
3. hit CTRL + F9 to switch from field content (value) to its name
4. hit CTRL + F2 to open More Fields
5. Now select Tab "Document"
6. Select "Author" from Type and "Name" from Select, then click Insert

Actual Results:  
You'll notice that the first field reports "DocInformation:Created" while the second is "Author"

Expected Results:
Both fields should be "Author"


Reproducible: Always

User Profile Reset: Yes

Additional Info:


User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0
Comment 1 silvia 2017-05-29 15:04:10 UTC
Confirmed on Versione: 5.3.1.2
Build ID: e80a0e0fd1875e1696614d24c32df0f95f03deb2
Thread CPU: 4; Versione SO: Windows 6.1; Resa interfaccia: predefinito; Motore layout: nuovo; 
Versione locale: it-IT (it_IT); Calc: group
Comment 2 Aron Budea 2017-05-30 06:23:47 UTC
Already present in 3.3.0.

I kind of think it's just somewhat bad/overlapping naming of actually different data (at least data that is stored in different places, I haven't looked at where they're coming from exactly), but it is confusing.
Comment 3 Yousuf Philips (jay) (retired) 2017-06-04 13:38:25 UTC
So this isnt something that can be easily fixed within the menu xml file and needs to be fixed at the code level in the uno command (.uno:InsertFieldCtrl).

@Maxim, @Gulsah, @Regina: Anyone have some time to fix this bug that should likely be a 1-liner?
Comment 4 Gabriele Ponzo 2017-06-05 11:16:38 UTC
Notice that it could be that simple but also not, because sometimes the result is correct, even if the field is wrong.

So it happens that "DocInformation:Created" gives back the author name as result... so there could be an error in this too.

What I'd expect from such a field should be the creation (date?) of that document. But I may be wrong in this case.

Anyway I suggest to investigate on what should be the output of this field and why it gives the author name.
Comment 5 Regina Henschel 2017-06-05 14:26:50 UTC
There exists two places, where information about the authors and dates are stored, one is the meta.xml file and the other the content.xml file, inside the ODF package.

With the fields in the tab DocInformation in the "More Fields" dialog, you get fields, which mirror the content of the meta.xml file. They are:

For the initial author:
    Created Author = text:initial-creator = meta:initial-creator
    Created Time/Date = text:creation-time/date = meta:creation-date
This information is stored once with the first saving. Using Field > Author you get an element text:initial-creator.

For the current author:
    Modified Author = text:creator = dc:creator
    Modified Time/Date = text:modification-time/date = dc:date
This information is updated with each saving.

Both are shown in File > Properties in the tab "General".



With the fields in the tab Document, you use the elements text:author-name (which combines first and last name) and text:author-initials for the initial author and the elements text:sender-firstname, text:sender-lastname and text:sender-initials for the subsequent authors. Content can be fixed by the checkbox. These information is only stored in the content.xml file. Because of the possibility to fix content, you can track intermediate authors.

Unless fixed, the information about the current author is updated in the sender...-fields, when you change and save the document. You need to save the document, otherwise you might see an old value in the field.


LibreOffice fills these fields automatically from the information in Tools > Options > LibreOffice > User data.

For me the Field dialog is a little bit confusing in regard to authors, but it corresponds to the elements in the ODF file format and therefore I see no bug here. If you see inconsistent values, perhaps you have not saved your document or you have unchecked the option Automatically Update Fields?
Comment 6 Yousuf Philips (jay) (retired) 2017-06-05 21:45:04 UTC
(In reply to Gabriele Ponzo from comment #4)
> Notice that it could be that simple but also not, because sometimes the
> result is correct, even if the field is wrong.
>
> So it happens that "DocInformation:Created" gives back the author name as
> result... so there could be an error in this too.

(In reply to Regina Henschel from comment #5)
> For me the Field dialog is a little bit confusing in regard to authors, but
> it corresponds to the elements in the ODF file format and therefore I see no
> bug here. If you see inconsistent values, perhaps you have not saved your
> document or you have unchecked the option Automatically Update Fields?

Well as Title is using 'DocInformation:Title' and Subject is using 'DocInformation:Subject', author should be fine using 'DocInformation:Created', though if you change the values in Tools > Options > LibreOffice > User data in an unsaved document, 'Author' will correctly update and 'DocInformation:Created' wont even if you updated fields.
Comment 7 Gabriele Ponzo 2017-06-05 22:09:56 UTC
(In reply to Yousuf Philips (jay) from comment #6)

> Well as Title is using 'DocInformation:Title' and Subject is using
> 'DocInformation:Subject', author should be fine using
> 'DocInformation:Created', 

IMHO it should be Creator or CreatedBy but surely not Created which leads me thinking of a date or a Boolean...

though if you change the values in Tools > Options
> > LibreOffice > User data in an unsaved document, 'Author' will correctly
> update and 'DocInformation:Created' wont even if you updated fields.

Correct, so it looks like it is just a naming issue in those fields AND in menu / dialog items, because since they are two different data, they should be referred with different words in items.

Even Author could be improved in LastAuthor or so, if I understood correctly its meaning, but that's not so important at the moment, and probably not so easy to change, if ODF tags are implied.
Comment 8 Commit Notification 2018-02-08 21:56:39 UTC
Gabriele Ponzo committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=badbdb41acf69e3eba4ca7253ec0218dc1e63d0a

tdf#108224: rename insert author menu entry

It will be available in 6.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Yousuf Philips (jay) (retired) 2018-02-13 08:23:46 UTC
(In reply to Gabriele Ponzo from comment #7)
> IMHO it should be Creator or CreatedBy but surely not Created which leads me
> thinking of a date or a Boolean...

That is how ODF has decided to name the field in the XML, so if you think it should be changed, then you should take it up with them.

> Correct, so it looks like it is just a naming issue in those fields AND in
> menu / dialog items, because since they are two different data, they should
> be referred with different words in items.

They are the same data but one gets updated automatically and one gets updated only after opening a document.

(In reply to Commit Notification from comment #8)
> Gabriele Ponzo committed a patch related to this issue.
> It has been pushed to "master":
> 
> http://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=badbdb41acf69e3eba4ca7253ec0218dc1e63d0a
> 
> tdf#108224: rename insert author menu entry

This should be reverted as it isnt the right fix. The correct fix would be to change the underlying code to insert the 'Author' field rather than 'DocInformation:Created', if others agree this is the preferred field to insert.
Comment 10 Heiko Tietze 2018-02-13 09:42:23 UTC
(In reply to Yousuf Philips (jay) from comment #9)
> This should be reverted as it isnt the right fix. The correct fix would be
> to change the underlying code to insert the 'Author' field rather than
> 'DocInformation:Created', if others agree this is the preferred field to
> insert.

I agree with Gabriele that just "Author" is misleading. And the solution with "First Author" makes it more clear. On the other hand most users likely want to insert the actual/current author.

Tried the obvious thing and modified 

DI_CREATE|DI_SUB_AUTHOR to DI_CHANGE|DI_SUB_AUTHOR in
https://opengrok.libreoffice.org/xref/core/sw/source/uibase/shells/textfld.cxx#715

but with not success on the fly.
Comment 11 Xisco Faulí 2018-05-29 09:14:51 UTC
Dear Gabriele Ponzo,
This bug has been in ASSIGNED status for more than 3 months without any
activity. Resetting it to NEW.
Please assigned it back to yourself if you're still working on this.
Comment 12 QA Administrators 2019-05-30 02:54:41 UTC Comment hidden (obsolete)
Comment 13 Gabriele Ponzo 2020-02-04 11:08:42 UTC
Thanks for the reminder.

I've just checked and it looks like it's been solved.