tristanpriem / qcal

Automatically exported from code.google.com/p/qcal
0 stars 0 forks source link

Holidays are duplicated #24

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Observe the holidays in calendar

What is the expected output? What do you see instead?
If 1st January is a holiday, I hope to see only this day marked as holiday.
Instead of it I see days 1 and 2 of January marked as holidays.
This happens for another holidays.  

What version of the product are you using? On what operating system?
qCal-v0.0.2
Ubuntu 10 e 12
Debian 5 e 6

Please provide any additional information below.

For fixing this problems, the following changes must be applied into release 
qCal-v0.0.2:

File: qCal/lib/qCal/Component.php 
Change the line 244:

if (!array_key_exists($tzid, $tzids)) {

for this:

if (!in_array($tzid, $tzids)) {

File: qCal/lib/qCal/DateTime.php

Insert into line 47 (beginning of method factory()), this code:

if (substr($datetime,0,4)=='TZID') {
    // Handle DateTime with Timezones
    $buffer = explode(';', $datetime, 2);
    $datetime = $buffer[1];
    $buffer = explode('=', $buffer[0], 2);
    $timezone = $buffer[1];
} 

File: /qCal/lib/qCal/Parser/Lexer/iCalendar.php

Remove the lines 17 from 20 (attribute $line_terminator) and 27.

Replace line 103 with this code:

// handle linux AND windows line-breaks!
$content = str_replace("\r", "\n", $content);
$lines = explode("\n", $content);

Original issue reported on code.google.com by flaviogo...@gmail.com on 9 Apr 2014 at 2:13

GoogleCodeExporter commented 9 years ago
Ah, a little detail:

Into file qCal/lib/qCal/Component.php, it is needed to include the line:

$tzids = array_keys($timezones);

after line:

$timezones = $this->getTimezones();

Original comment by flaviogo...@gmail.com on 9 Apr 2014 at 5:35