Issue 19763

Summary: cannot save certain date formats in form controls
Product: Base Reporter: udomerk <svomb>
Component: codeAssignee: frank
Status: CLOSED FIXED QA Contact: issues@dba <issues>
Severity: Trivial    
Priority: P3 CC: issues
Version: OOo 1.1 RC4   
Target Milestone: OOo 2.0   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description udomerk 2003-09-18 15:26:00 UTC
Maybe a problem like 16577. 
 
Format now a datefield as "date format: standard (long)". 
Close the file and open it again.  
 
The datefield is always formatted as standard short, 
at least on my linux box. 
 
I do not have a windows box to verify this under a different OS. 
Sorry. But it is definitely working under win&linux OOo 1.03.
Comment 1 marc.neumann 2003-10-09 10:33:24 UTC
target, confirm, send to the right developer
Comment 2 Frank Schönheit 2003-10-13 09:06:52 UTC
accepting
Comment 3 Frank Schönheit 2003-10-23 10:26:32 UTC
fs->sab: There seems to be a problem with the SvXMLNumFormatContext.

We export the date format of the control as number style. The format
string for the chose format ("standard (long)") is "NNNNT. MMMM JJJJ",
with locale "de-DE". This is what is what we write upon export. In the
content.xml, this arrives as:
  <number:date-style style:name="C5038" style:family="data-style"
      number:language="de" number:country="DE"
      number:automatic-order="true" number:format-source="language">
   <number:day-of-week number:style="long"/>
   <number:text>, </number:text>
   <number:day number:style="long"/>
   <number:text>. </number:text>
   <number:month number:style="long" number:textual="true"/>
   <number:text> </number:text>
   <number:year number:style="long"/>
  </number:date-style>

When reading the document, a SvXMLNumFormatContext is created for this
tag. We now ask the context for the format string (method GetFormat),
and what it returns is "NNNNTT. MMMM JJJJ" (note the additional 'T'!).
Since our date control does not support this format, it falls back to
the default (standard short).

To me, the problem seems to be that the GetFormat returns a wrong
format string - the XML representation of "NNNNTT. MMMM JJJJ" would
have been:
  <number:date-style style:name="C5038" style:family="data-style"
      number:language="de" number:country="DE">
    .
    . (same as above)
    .
  </number:date-style>

Note the missing "automatic-order" and "format-source" attributes.
So in my opinion, the SvXMLNumFormatContext::GetFormat doesn't respect
the "automatic-order" and/or "format-source" attributes.
Comment 4 sascha.ballach 2003-10-23 11:34:54 UTC
Hi Niklas,

please have a look at this.

Thanks Sascha
Comment 5 niklas.nebel 2003-10-27 14:13:36 UTC
Sascha, the handling of "automatic-order" and "format-source" is in
SvXMLNumFormatContext::CreateAndInsert, but not in
SvXMLNumFormatContext::GetFormat. SvXMLNumFormatContext::GetFormat is
something between you and Frank. I have never touched that method and
don't know if it can be changed there without breaking something else.
Comment 6 marc.neumann 2003-10-28 08:13:29 UTC
Set to 1.1.2 because of developer limit
Comment 7 sascha.ballach 2003-10-28 09:02:18 UTC
ok, I take it and will have a look on it.
Comment 8 Frank Schönheit 2004-01-14 10:38:12 UTC
I noticed a simlar effect for the formatted control: When you set a certain date
format, then this format is also lost/changed upon reloading the document. In
particular, the following date formats (in a german notation :) are affected:

NNNNT. MMMM JJJJ
TT.MM.JJ
T. MMMM JJJJ
TT.MM.JJ HH:MM

To me it seems as if this is the same bug, since these formats also use the XML
attributes which GetFormat ignores. So, when this bug is fixed, we should also
verify that the formatted control works properly with all date formats then.
Comment 9 hans_werner67 2004-02-02 12:30:19 UTC
change subcomponent to 'none'
Comment 10 marc.neumann 2004-03-10 13:12:45 UTC
retarget to OOo 2.0 as agreed with sab , fs , msc.
Comment 11 marc.neumann 2004-05-05 08:16:13 UTC
*** Issue 28732 has been marked as a duplicate of this issue. ***
Comment 12 Frank Schönheit 2004-05-05 08:26:13 UTC
changing summary from
  another form datefield problem
to
  cannot save certain date formats in form controls

to better reflect what this is about (and perhaps to prevent duplicates)
Comment 13 Frank Schönheit 2004-05-05 08:26:44 UTC
argh. Now really.
Comment 14 jameslee 2004-05-05 09:38:52 UTC
Just to let you know I have a user who never wants to use OOo again because of
this bug. Please raise priority to 9.

Yes, we are sick of US format dates, US paper, and settings that don't stick.
Comment 15 davidbell 2005-01-26 20:25:27 UTC
This is probably related (or if not I can submit an new issue if you prefer)

(OOo 1.9.71) Using the short date format, if both values for DD & MM are lower 
than 12, they are reversed as soon as the current row/record is saved or loses 
focus. So for eg 8th Sept becomes 9th Aug. Where the day is greater than 12, 
it comes out normally. This makes entering dates very unreliable. 

BTW in Australia we use DD MM YY instead of MM DD YY as in the USA, which 
might have soemthing to do with it.

Davgid Bell
Comment 16 sascha.ballach 2005-02-15 12:46:12 UTC
fixed
Comment 17 sascha.ballach 2005-03-01 13:06:38 UTC
please verify

re-open issue and try to reassign to fst@openoffice.org
Comment 18 sascha.ballach 2005-03-01 13:06:41 UTC
try to reassign to fst@openoffice.org
Comment 19 sascha.ballach 2005-03-01 13:06:45 UTC
try to reset resolution to FIXED
Comment 20 frank 2005-03-08 10:33:21 UTC
Found fixed on cws Calc30 using Windows and Linux version to test
Comment 21 frank 2005-03-31 12:42:39 UTC
found integrated on master src680m89