Issue 97029

Summary: Document Custom Property of type Date resets time value
Product: General Reporter: bmarcelly <marcelly.bernard>
Component: uiAssignee: michael.ruess
Status: CLOSED FIXED QA Contact: issues@framework <issues>
Severity: Trivial    
Priority: P3 CC: bernd.eilers, issues, mst.ooo, os_ooo
Version: DEV300m37   
Target Milestone: OOo 3.3   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
Test Document with unsual specified editing duration
none
Test Document with a large editing duration none

Description bmarcelly 2008-12-08 17:51:06 UTC
In the Document > Properties > Custom Properties tab, a property of type "Date" does 
not display the time part (hh:mm:ss nn).
However it is stored as a com.sun.star.util.DateTime and the time can be saved.
If a script stores a complete date+time in this property it is saved and date+time 
can be read again later.
But if the user displays the Custom Properties panel and clicks OK, the time part is 
reset. This change is not visible from the user.

There is inconsistency between the user interface and the internal storage : either 
the structure com.sun.star.util.Date should have been used, or the user interface 
should display and handle the time part.

IMHO a complete date+time would be more useful than date only, so the user interface 
should be corrected.
Comment 1 pb 2009-01-16 13:23:20 UTC
pb: I take over.
Comment 2 mst.ooo 2009-04-27 14:49:12 UTC
*** Issue 101376 has been marked as a duplicate of this issue. ***
Comment 3 bernd.eilers 2009-04-27 16:13:32 UTC
Issue i101376 which has been marked as duplicate for this issue contains
conformance test documents from the OASIS ODF TC Interoperability and
Conformance relevant to this issue.

Comment 4 mst.ooo 2009-10-06 15:58:21 UTC
@os:
please fix the dialog in sfx2; this is purely an UI issue.
the dialog should support util::Date, util::DateTime, and util::Time properties
for date/time.
Comment 5 mst.ooo 2009-10-06 16:19:07 UTC
*** Issue 100704 has been marked as a duplicate of this issue. ***
Comment 6 mst.ooo 2009-10-06 16:32:50 UTC
.
Comment 7 Oliver Specht 2009-10-07 08:58:18 UTC
*** Issue 100703 has been marked as a duplicate of this issue. ***
Comment 8 Oliver Specht 2009-10-08 15:02:59 UTC
Fixed in cws os137 in 
sfx2/inc/sfx2/dinfdlg.hxx
sfx2/source/dialog/dinfdlg.cxx
sfx2/source/dialog/dinfdlg.hrc
sfx2/source/dialog/dinfdlg.src
sfx2/source/inc/sfxlocal.hrc

The type list is enhanced by "DateTime" and "Time" entries. The dialog now
provides a DateField and a TimeField instead of the Edit.
Comment 9 Oliver Specht 2009-11-12 14:38:35 UTC
Reassigned for verification
Comment 10 bernd.eilers 2009-11-16 17:07:34 UTC
reopening issue: can still not specify a duration on os137 CWS as was asked for
in issue i100703 which was marked as duplicate for this issue. The duration type
is specified in
http://www.oasis-open.org/committees/download.php/33633/OpenDocument-v1.2-part1-cd03.odt
section 3.3.3.A duration is something completely different than a time value and
is another possible type for a custom metafield not implemented yet with os137.
Comment 11 bernd.eilers 2009-11-16 17:08:59 UTC
reassigned for implementation
Comment 12 mst.ooo 2009-11-17 10:08:43 UTC
so i had a look at the ODF schema, relevant parts for meta:user-defined:

            <group>
                <attribute name="meta:value-type">
                    <value>date</value>
                </attribute>
                <ref name="dateOrDateTime"/>
            </group>
            <group>
                <attribute name="meta:value-type">
                    <value>time</value>
                </attribute>
                <ref name="duration"/>
            </group>

<define name="dateOrDateTime">
    <choice>
        <data type="date"/>
        <data type="dateTime"/>
    </choice>
</define>


looking at XMLSchema-2, in dateTime the date part is mandatory.
so we have value-type="date" with value of type "date" or "dateTime",
and value-type="time" with value of type "duration".

in other words, there is no value of type "time".

maybe the property type in the UI should be "Duration" instead of "Time"?

Comment 13 mst.ooo 2009-11-17 10:09:35 UTC
oops, forgot to CC: bei; please look at the previous comment from me
Comment 14 bernd.eilers 2009-11-17 10:32:35 UTC
bei->mst: I would interpretate it like you as well value-type="time" should
indeed be a duration and not a time like it was implemented on os137. Please
have a look at Issue 101376, which was marked as duplicate for this issue, for
Testdocuments from the OASIS Interoperability TC. Those are not correctly
handled yet with the fixes on os137.
Comment 15 bernd.eilers 2009-11-17 11:02:21 UTC
bei->os: See §3.2.6 of the xmlschema-2 specification for more detailed
information on the ISO 8601 duration format as it must be stored in the
document. http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#duration. For the
UI we can probably find something more sexy than the ISO 8601 representation.
The test documents of issue i101376 contain a variable named "user-time" with
such a value. The total editing time on the first tabpage of the properties
dialog by the way is stored in the same format. Note that a time value without a
date as currently implemented on os137 is not specified in the ODF Standard.
Comment 16 mst.ooo 2009-11-17 12:52:44 UTC
indeed, the "duration" is not just a time, but a date and time, where every
single component may be ommitted if it is 0.

sorry, must have overlooked that.

it seems to me that we cannot currently distinguish a duration from a date in
the API.
Comment 17 bernd.eilers 2009-11-17 13:32:59 UTC
bei->mst: that exactly is it NOT a date + a time. It´s a "duration" not a
DateTime. It is something like the difference between two DateTime values, which
is specified as an amount of years, months, days, hours, minutes and seconds.
Comment 18 mst.ooo 2009-11-17 13:40:13 UTC
sorry, what i meant to say is: duration has all the _components_ of a date+time,
not just those of a time (which was my original flawed assumption).
Comment 19 bernd.eilers 2009-11-17 13:48:17 UTC
bei->mst: Duration has NONE of the components of our Date, Time and DateTime
classes in the tools library it simply elapsed time as opposed to the time of
the clock as is represented by our Time class and implemented on os137.
Comment 20 bernd.eilers 2009-11-17 13:59:40 UTC
The UI should allow the user to specify a data type of "elapsed time" or
"duration" as something like "10 years 5 Months 6 Days 2 Hours 15 Minutes and 45
seconds" or just "20 Minutes" not something like a 24-Hour "clock time" as in
"15:00". This is the original flawed assumption.
Comment 21 mst.ooo 2009-11-19 11:05:09 UTC
i have just committed support for full XMLSchema-2 "duration" properties in the
DocumentProperties services.
the "duration" is stored as a new struct css.util.Duration.

now os can implement support in the dialog and in the writer docufld.cxx
(see issue 105687).
Comment 22 Oliver Specht 2009-11-23 14:37:40 UTC
Duration now supported.
Comment 23 Oliver Specht 2009-11-24 13:25:02 UTC
Reassigned for verification
Comment 24 michael.ruess 2009-11-25 14:07:16 UTC
MRU->BEI: could you please also have a look at this now, if your resources may
allow this? For me, this looks ok now in newer build of os137. Do you agree?
Comment 25 bernd.eilers 2009-12-01 17:05:40 UTC
bei->mru,mst,os: I am mostly but not totally satisfied yet. Although the main
problems have been solved there is one issue left with the import of a duration
value in the <meta:edit-duration> field which is shown as total editing time in
the User Interface. The problem here is that if there is a value being used
which uses month and year subparameters these are simply ignored. This is not in
accordance to the recommendation currently discussed in the OASIS ODF
Interoperability and Conformance TC which I have communicated to mst by private
email before my vacation last week in addition to the comments in this issue.
The recommendation is that a ODF Producer should not use Month and Years
subparameters (which fortunately does not seem to be the case) but that a
consumer should interpret them like that a month there always means 30 Days and
a Year there always means 365 days. Calculating them as zero no matter what was
specified is an error. I will attach a test document
(unusual_editing_duration.odt) with a editing duration of 1 year 1 month 1 day 1
Hour 15 Minutes and 3 Seconds which can be used to demonstrate the error. The
total editing time shown for this document in the OpenOffice.org UserInterface
of CWS os137 is 25:15:03. This shows that month and year subvalues have been
completely ignored while days, hours, minutes and seconds have been use for
calculating the value shown.
Comment 26 bernd.eilers 2009-12-01 17:06:59 UTC
Created attachment 66441 [details]
Test Document with unsual specified editing duration
Comment 27 bernd.eilers 2009-12-01 17:14:46 UTC
bei->mru: I also checked all test documents of Issue 101376 which was marked as
a duplicate of this issue and those are all imported correctly now with the
current os137 OpenOffice.org.
Comment 28 bernd.eilers 2009-12-01 17:45:12 UTC
bei->mru,mst,os: large values for editing duration are also not imported
correctly. Will attach another test document (large_editing_duration.odt)
demonstrating this. This document has an editing duration of 400 Days 1 Hour 22
Minutes and 54 Seconds. The value shown in OpenOffice.org of current os137 CWS
is 1011:29:08 which is something completely different. I suppose there is still
some Time class used somewhere which can not handle these values instead of the
new Duration class.
Comment 29 bernd.eilers 2009-12-01 17:46:20 UTC
Created attachment 66442 [details]
Test Document with a large editing duration
Comment 30 michael.ruess 2009-12-02 08:45:03 UTC
Reassigning to MST for fixing import problems regarding bei's concerns.
Comment 31 mst.ooo 2009-12-02 09:18:58 UTC
i've broken out the meta:editing-duration bug into issue 107372.

this issue is about user-defined properties, and is FIXED.
Comment 32 mst.ooo 2009-12-02 09:20:32 UTC
please verify user-defined properties
Comment 33 bernd.eilers 2009-12-02 09:32:36 UTC
bei->mst: Agreed better to break that other thing out into a separate issue.
User Defined Properties do work fine now. All test documents in this area from
the Oasis ODF Interoperability & Conformance TC could be imported correctly. No
issues seen on export also. Setting issue to verified.
Comment 34 michael.ruess 2010-01-27 13:36:42 UTC
Checked in DEV300m70.