Uploaded image for project: 'iDempiere'
  1. IDEMPIERE-3888

Some date patterns (may) lead to print problems

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.2
    • Component/s: Report
    • Labels:
    • Sprint:

      Description

      The date pattern field in the language window is used for formatting dates when printing.
      A java style date pattern is expected. Some of these patterns are leading to errors when the database used is Oracle:
      when you use "MMM" ( the java pattern for the abbreviated month name) or "MMMM" (for the full month name) for the customers language and try to print an invoice you get error "ORA-01821: date format not recognized" instead.
      Reason is that DataEngine.getPrintData is constructing SQL to combine document number, date and amount using this pattern which is different from the SQL date pattern for abbreviated or full month name.
      The SQL part in question is

      (SELECT NVL(C_Invoice.DocumentNo,'-1') ||''|| NVL(TRIM(TO_CHAR(C_Invoice.DateInvoiced,'MMM/DD/YYYY')),'-1') ||''|| NVL(TRIM(TO_CHAR(C_Invoice.GrandTotal,'999G999G999G990D00')),'-1')

      It is constructed by DB_Oracle.TO_CHAR called from MLookupFactory.getLookup_TableDirEmbed called from DataEngine.getPrintDataInfo.

      Postgresql does not throw an error but interprets "MMM" as "MM" followed by an "M" and "MMMM" as two times "MM", leading to "02M" or "0202" for a date in February,

      The correct pattern for SQL would be "MON" for abbreviated name or "MONTH" for full name.
      Solution is a pattern translation in DB_Oracle.TO_CHAR and DB_Postgresql.TO_CHAR before returning the constructed string.

        Attachments

          Activity

            People

            • Assignee:
              carlosruiz_globalqss Carlos Ruiz
              Reporter:
              a42niem Dirk Niemeyer
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: