Changeset 6160


Ignore:
Timestamp:
05/10/12 17:40:45 (9 years ago)
Author:
acoutinho
Message:

Ticket #2714 - Inconsistencia na query de busca de repeticoes

File:
1 edited

Legend:

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

    r6151 r6160  
    118118            $occ = array(); 
    119119 
    120             if ($occurrences = self::checkOccurrences($start[0], $end[0])) 
     120            if ($occurrences = self::checkOccurrences($start[0], $end[0], $criteria['filter'][2][2])) 
    121121                foreach ($occurrences as $id => $occurrence) { 
    122122                    $ids[] = $id; 
     
    143143                .'AND calendar_object.id NOT IN (\'' . implode('\',\'', $ids) . '\')' : ''); 
    144144 
     145 
    145146            $params = Controller::service('PostgreSQL')->execResultSql($sql); 
    146147 
     
    209210    } 
    210211 
    211     public function checkOccurrences($start, $end) { 
     212    public function checkOccurrences($start, $end, $calendarIds) { 
    212213 
    213214        $ranges = Controller::find(array('concept' => 'repeatRange'), array('rangeStart', 'rangeEnd'), array('filter' => array('=', 'user', Config::me("uidNumber")))); 
     
    224225        } 
    225226 
    226         $repeats = self::findRepeats(); 
    227  
     227        $repeats = self::findRepeats($calendarIds); 
    228228        if (!is_array($repeats) || empty($repeats)) 
    229229            return( false ); 
     
    302302    } 
    303303 
    304     public static function findRepeats() { 
    305         return Controller::service('PostgreSQL')->execResultSql('SELECT calendar_repeat.wkst as "wkst", calendar_repeat.byweekno as "byweekno", calendar_repeat.byminute as "byminute", calendar_repeat.bysecond as "bysecond", calendar_repeat.byyearday as "byyearday", calendar_repeat.bymonthday as "bymonthday", calendar_repeat.bysetpos as "bysetpos", calendar_repeat.byday as "byday", calendar_repeat.byhour as "byhour", calendar_repeat.interval as "interval", calendar_repeat.frequency as "frequency", calendar_repeat.until as "endTime", calendar_repeat.id as "id", calendar_repeat.count as "count", calendar_repeat.dtstart as "startTime" FROM calendar_repeat, calendar_participant WHERE calendar_repeat.object_id = calendar_participant.object_id AND calendar_participant.user_info_id = \'' . Config::me('uidNumber') . '\''); 
     304    public static function findRepeats($ids) { 
     305        return Controller::service('PostgreSQL')->execResultSql('SELECT calendar_repeat.wkst as "wkst", calendar_repeat.byweekno as "byweekno", calendar_repeat.byminute as "byminute", calendar_repeat.bysecond as "bysecond", calendar_repeat.byyearday as "byyearday", calendar_repeat.bymonthday as "bymonthday", calendar_repeat.bysetpos as "bysetpos", calendar_repeat.byday as "byday", calendar_repeat.byhour as "byhour", calendar_repeat.interval as "interval", calendar_repeat.frequency as "frequency", calendar_repeat.until as "endTime", calendar_repeat.id as "id", calendar_repeat.count as "count", calendar_repeat.dtstart as "startTime" FROM calendar_repeat, calendar_to_calendar_object WHERE calendar_repeat.object_id = calendar_to_calendar_object.calendar_object_id AND calendar_to_calendar_object.calendar_id IN (\'' . implode('\',\'', $ids) . '\')'); 
    306306    } 
    307307 
Note: See TracChangeset for help on using the changeset viewer.