Problem with invoice date

mikestp27
mikestp27
Offline
0
Hello,
I've made several invoices (and quotes) already without a problem. And now I just got an invoice with a date problem. It's the first time it happens but I need to prepare an invoice for a date in the future. I'm trying to prepare an invoice for April 1st but it doesn't work. In the invoice "editor", I can clearly see "April 1st", but in the "invoices" page it's listed as march 31st and when I print the invoice, I also get march 31st. This is not an april 1st joke by the way... ;)
I read your forums and checked the server time zones. Everything is set to "America/Toronto". PHP, MySQLand Joomla are all running in that time zone.
I temporarily worked around the issue by setting the date in the invoice editor to April 2nd and then it prints as April 1st and I sent it to the customer.
But I'd like to have an appropriate fix.
Thank you.
Responses (10)
  • Accepted Answer

    Saturday, March 21 2015, 04:59 PM - #Permalink
    0
    Hello,

    Thanks for notifying this. We are aware of some date issues like this one which will be fixed in the next release, which we hope to release as soon as possible!
    The reply is currently minimized Show
  • Accepted Answer

    mikestp27
    mikestp27
    Offline
    Monday, June 22 2015, 02:01 PM - #Permalink
    0
    Good morning,
    Do you have any idea when this might get fixed?
    Thank you.
    • Germinal Camps
      more than a month ago
      hello, we are close to release the new version, however these issues should be solved in most cases... you get this error in which page? invoice view? or invoices list view? or both?
    The reply is currently minimized Show
  • Accepted Answer

    mikestp27
    mikestp27
    Offline
    Tuesday, June 23 2015, 02:08 PM - #Permalink
    0
    Good morning. We're running Joomla 3.4.1, the server itself is configured for "Toronto" time zone (GMT-5) and Joomla-Server-Config is set to "Toronto" also. We see the problem at different places. Some examples: 1. In invoices list view, enter "2015-01-01" as start filter and then the "Total Invoice" block shows the amount and "From 31 Dec 2014". 2. Create a new invoive in the morning, enter a date, save it, in the invoice list it shows the day before the invoice (however, create an invoice in the evening, save and the invoice lists shows the right date). 3. When enter a payment, enter a date, save, it shows being paid the day before the date entered.
    • Germinal Camps
      more than a month ago
      ok thanks, I see. This will be solved in next release (it only appears on some server configurations, aparently). however, if you want, if you can send us access to the site we can fix it for you in-situ right away.
    The reply is currently minimized Show
  • Accepted Answer

    mikestp27
    mikestp27
    Offline
    Tuesday, June 23 2015, 04:46 PM - #Permalink
    0
    Hello, thank you for the quick response. What type of access to the site do you need? I'm not sure I like the idea... sorry. Do you need just Joomla admin or root access? Or if you tell me what needs to be changed, I'm sure I can do it. Thank you.
    • Germinal Camps
      more than a month ago
      No problem, it's understandable. I would need FTP access (although ONLY to the com_invoices folder, no need to have access to the rest of the site's files)
      the problem is that it's difficult to tell you what needs to be changed because most likely there will be many files involved. But if you feel really confortable with PHP I can tell you what to change..! :)
    The reply is currently minimized Show
  • Accepted Answer

    mikestp27
    mikestp27
    Offline
    Tuesday, June 23 2015, 05:01 PM - #Permalink
    0
    I'm very confortable with PHP... thank you.
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, June 23 2015, 05:06 PM - #Permalink
    0
    great! then, here it comes:
    basically what needs to be done is to pre-process all dates using the function "strtotime()" each time the function JHTML::_('date' is called.

    example: in file /administrator/components/com_invoices/views/invoices/tmpl/default.php you will find this (search for it with a search function)

    echo JHTML::_('date', $row->invoice_date, JText::_('DATE_FORMAT_PAYMENTS'));

    in this case, you should replace it for this:

    echo JHTML::_('date', strtotime($row->invoice_date), JText::_('DATE_FORMAT_PAYMENTS'));

    the same way, in other places that this function appears, you should do the same (you have a few on this page, at the top for instance, you have this:

    JHTML::_('date', $this->cal_start, JText::_('DATE_FORMAT_PAYMENTS'))

    which is what prints the date info of the date filter, which is causing you problems as well. you should apply the same change here.

    The reason for all this is that the function JHTML::_('date', which is a native joomla function, seems to work erratically since Joomla 3. We found out that the best way to avoid this issue is, usually, the fix explained above..

    hope this helps...
    The reply is currently minimized Show
  • Accepted Answer

    mikestp27
    mikestp27
    Offline
    Wednesday, June 24 2015, 04:49 PM - #Permalink
    0
    I was sceptical at first but it seems to work. I though it would have to do with time zones but apparently it's something else. I made the change you listed above and it works. Except for one file where I didn't apply the change (if I do, it breaks...), the file is: components/com_invoices/views/invoice/tmpl/default.php. Is it normal to not apply the fix to that file?
    • Germinal Camps
      more than a month ago
      at which line are you applying the change on that file?
    The reply is currently minimized Show
  • Accepted Answer

    mikestp27
    mikestp27
    Offline
    Thursday, June 25 2015, 01:53 PM - #Permalink
    0
    The one file where I could not apply the change was: components/com_invoices/views/invoice/tmpl/default.php. The search had found hits on lines: 117, 118, 155, 156, 191 and 249. If I add the strtotime on those lines, then Joomla returns an error page when I try to view an invoice or save it to pdf. The error I get seems to come from lines 155 or 156 and the error message is: DateTime::__construct(): Failed to parse time string (-001-11-30T07:00:00+00:00) at position 7 (-): Double timezone specification
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, June 25 2015, 01:54 PM - #Permalink
    0
    ok. don't apply it to that file, it should be ok without it.
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, August 26 2015, 10:32 PM - #Permalink
    0
    I am getting the same error message when trying to view invoices. If I removed the strtotime function call and just use

    $payment_duedate = JHTML::_('date',$payment->payment_duedate, JText::_($this->params->get('invoice_date_format', 'DATE_FORMAT_LC3')), false) ;
    $payment_datetime = JHTML::_('date',$payment->payment_datetime, JText::_($this->params->get('invoice_date_format', 'DATE_FORMAT_LC3')), false) ;

    in lines 155&156 in /components/com_invoices/views/invoice/tmpl/default.php

    I still get the "DateTime::__construct(): Failed to parse time string (-001-11-30T07:52:58+00:00) at position 7 (-): Double timezone specification" error message.

    The weird thing is that IM can read invoices generated from 2014, but not the recent ones…

    So I removed all references to strtotime in that default.php. And for now it seems to be working as expected.

    Very frustrating.

    IM: 1.3.3
    Joomla: 3.4.3
    Server TZ: CDT
    Joomla TZ: PST (2 hrs behind)
    The reply is currently minimized Show
Your Reply