Menu Content

Support

> Forums, FAQs & Paid Support
Welcome, Guest
Username Password: Remember me

500 - DateTime::__construct() [datetime.--construc
(1 viewing) (1) Guest
Universal booking and reservations component for Joomla!.

NOTE: This category has been locked. If you have purchased paid version, please, use our Support Ticket system instead. If you are using free edition, please see the Community Support section.

TOPIC: 500 - DateTime::__construct() [datetime.--construc

Re: 500 - DateTime::__construct() [datetime.--construc 11 years, 11 months ago #35413

Hello,

you have to check that it's the first week of the year. I had the problem with the function getWeekCalendar. The problem is with this line: $setting->year . '-W' . str_pad($setting->week, 2, '0', STR_PAD_LEFT). This doesn't work if $setting->week is equal to 0.
So you can do something like this:

 
if((int)$setting->week > 0) $calc_date=$setting->year . '-W' . str_pad($setting->week, 2, '0', STR_PAD_LEFT);
else $calc_date=$setting->year;
 


And use $calc_date instead of $setting->year . '-W' . str_pad($setting->week, 2, '0', STR_PAD_LEFT) everywhere in the function. It seems to have solved the problem for me.

Happy new year !!!
The topic has been locked.

Re: 500 - DateTime::__construct() [datetime.--construc 11 years, 11 months ago #35421

Ok sorry it's not good.

It makes further calculations wrong.

I correct it like this: in the function getWeekCalendar, I replace the line.

$setting->currentWeek = (int) $current->toFormat('%W');


by

$setting->currentWeek = (int) $current->toFormat('%W')+1;


But then I have to change the function getWeekSelect replacing this line:

$arr[] = JHTML::_('select.option', $week . ',' . $year, $week . '/' . $year);


by

$arr[] = JHTML::_('select.option', $week+1 . ',' . $year, $week+1 . '/' . $year);


But I'm not sure it will not affect the rest of the code. An answer from ARTIO would be great.
The topic has been locked.

Re: 500 - DateTime::__construct() [datetime.--construc 11 years, 11 months ago #35422

Hi, I have same problem, this morning I found the problem.

What should I do to repair the bug?

Thanks for you help
Attachments:
The topic has been locked.

Re: 500 - DateTime::__construct() [datetime.--construc 11 years, 11 months ago #35424

In which file?
The topic has been locked.

Re: 500 - DateTime::__construct() [datetime.--construc 11 years, 11 months ago #35425

  • esi
  • OFFLINE
  • Posts: 8
Hi De Pic,

which file did you edit to get it to work?
The topic has been locked.

Re: 500 - DateTime::__construct() [datetime.--construc 11 years, 11 months ago #35426

First in administrator/com_booking/helpers/booking.php, second in administrator/com_booking/helpers/html.php but I think there is more code to edit. It solves the problem for me but you must know that my version of com_booking has been modified.

In fact the problem is the call to $current->toFormat('%W') which returns 0 for the first week of the year. We should get 1.
The topic has been locked.
User Login Empty