Menu Content

Support

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

Profile for De PIC

  • OFFLINE
  • Time Zone: GMT +0:00
  • Local Time: 23:44
  • Posts: 3
  • Profile Views: 2136
  • Location: Unknown
  • Gender: Unknown
  • Birthdate: Unknown

Signature

Posts

Posts

emo
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.
500 - DateTime::__co ...
Category: Customer Support
emo
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.
500 - DateTime::__co ...
Category: Customer Support
emo
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 !!!
500 - DateTime::__co ...
Category: Customer Support
More
User Login Empty