Ignore:
Timestamp:
06/18/12 12:26:38 (12 years ago)
Author:
acoutinho
Message:

Ticket #2864 - Problema com os eventos que contem repeticao

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/prototype/modules/calendar/interceptors/DBMapping.php

    r6528 r6533  
    149149                        .'(range_start >= \'' . $start[1] . '\' AND range_start <= \'' . $end[1] . '\') OR ' 
    150150                        .'(range_start <= \'' . $start[2] . '\' AND range_end >= \'' . $end[2] . '\')) ' 
    151                 .(!empty($ids) ? ' ' .'AND calendar_object.id NOT IN (\'' . implode('\',\'', $ids) . '\') ' : ' '); 
    152  
     151                .(!empty($ids) ? ' ' .'AND calendar_object.id NOT IN (\'' . implode('\',\'', $ids) . '\') ' : ' ') 
     152                .'AND calendar_object.dtstart NOT IN (SELECT calendar_repeat_occurrence.occurrence from calendar_repeat_occurrence, ' 
     153                .'calendar_repeat where (calendar_repeat_occurrence.repeat_id = calendar_repeat.id) ' 
     154                .'AND (calendar_repeat.object_id = calendar_object.id))'; 
    153155 
    154156                $params = Controller::service('PostgreSQL')->execResultSql($sql.$where); 
     
    206208        //Recurepa as execeções anteriores caso exista 
    207209        if (isset($lastExceptions) && count($lastExceptions) && $lastExceptions) 
    208             foreach ($lastExceptions as $key => $value) 
    209                 array_push($exceptions, $lastExceptions[$key]['occurrence']); 
     210            foreach ($lastExceptions as $value) 
     211                array_push($exceptions, $value['occurrence']); 
    210212 
    211213        $params = array_diff(self::decodeRepeat($repeat, $ranges[0]['rangeStart'], $ranges[0]['rangeEnd']), $exceptions); 
     
    215217        if (!empty($params)) 
    216218            Controller::service('PostgreSQL')->execResultSql("INSERT INTO calendar_repeat_occurrence(repeat_id,exception,occurrence)VALUES('" . $id . "','0','" . implode("'),('" . $id . "','0','", $params) . "')" . ( empty($exceptions) ? "" : ",('" . $id . "','1','" . implode("'),('" . $id . "','1','", $exceptions) . "')" )); 
    217     } 
     219        else if(!empty($exceptions)) 
     220            Controller::service('PostgreSQL')->execResultSql("INSERT INTO calendar_repeat_occurrence(repeat_id,exception,occurrence)VALUES ('" . $id . "','1','" . implode("'),('" . $id . "','1','", $exceptions) . "')" ); 
     221    }        
    218222 
    219223    public function checkOccurrences($start, $end, $calendarIds) { 
Note: See TracChangeset for help on using the changeset viewer.