Changeset 7704


Ignore:
Timestamp:
01/04/13 09:54:02 (11 years ago)
Author:
cristiano
Message:

Ticket #3263 - Problema ao tentar aceitar um convite em conta compartilhada

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/prototype/services/iCal.php

    r7702 r7704  
    580580                        $interation['calendarToSchedulable://' . mt_rand() . '(Formatter)'] = $calendarToSchedulable; 
    581581 
    582                         if (isset($params['status'])) { 
    583                             if($params['owner'] != Config::me("uidNumber")){ 
     582                        if (isset($params['status'])) 
     583                        { 
     584                            if($params['owner'] != Config::me("uidNumber")) 
     585                            { 
    584586                                $user = Controller::Read(array('concept' => 'user'), false, array('filter' => array('=', 'id', $params['owner'])) ); 
    585587                                $pID = self::_getParticipantByMail($user[0]['mail'], $schedulable['participants']); 
    586                             }else{ 
     588                            } 
     589                            else 
     590                            { 
    587591                                $pID = self::_getParticipantByMail(Config::me('mail'), $schedulable['participants']); 
    588                                 //caso nõa seja participante adiciona a lista de participantes 
    589                                 if(!$pID){ 
    590                                     $pID =  mt_rand() . '2(Formatter)'; 
    591                                     $interation['participant://' . $pID]['status'] = $params['status']; 
    592                                     $interation['participant://' . $pID]['user'] = $params['owner']; 
    593                                     $interation['participant://' . $pID]['isOrganizer'] = '0'; 
    594                                     $interation['participant://' . $pID]['schedulable'] = $schedulable['id']; 
    595                                 }else 
    596                                     $interation['participant://' . $pID]['status'] = $params['status']; 
     592                            } 
     593                            //caso nõa seja participante adiciona a lista de participantes 
     594                            if(!$pID){ 
     595                                $pID =  mt_rand() . '2(Formatter)'; 
     596                                $interation['participant://' . $pID]['status'] = $params['status']; 
     597                                $interation['participant://' . $pID]['user'] = $params['owner']; 
     598                                $interation['participant://' . $pID]['isOrganizer'] = '0'; 
     599                                $interation['participant://' . $pID]['schedulable'] = $schedulable['id']; 
     600                            } 
     601                            else 
     602                            { 
     603                                $interation['participant://' . $pID]['status'] = $params['status']; 
    597604                            } 
    598605                        } 
     
    723730                        $participant['isOrganizer'] = '0'; 
    724731                        $participant['isExternal'] = 0; 
    725                         $participant['user'] = array('mail' => Config::me('mail'), 'name' => Config::me('cn')); 
     732 
     733                        $user = false; 
     734                        if($params['owner'] != Config::me("uidNumber")) 
     735                        { 
     736                            $user = Controller::Read(array('concept' => 'user'), false, array('filter' => array('=', 'id', $params['owner'])) ); 
     737                        } 
     738 
     739                        $participant['user'] = $user ?  array('mail' => $user['mail'], 'name' => $user['name']) : array('mail' => Config::me('mail'), 'name' => Config::me('cn')); 
     740 
    726741                        $sc['participants'][] = $participant; 
    727742                        $sc['type'] = EVENT_ID; 
     
    788803                        $mail['subject'] = parseTPL::load_tpl($subject, ROOTPATH . '/modules/calendar/templates/notify_subject.tpl'); 
    789804                        ; 
    790                         $mail['from'] = '"' . Config::me('cn') . '" <' . Config::me('mail') . '>'; 
     805                        $mail['from'] = $user ? '"' . $user['name'] . '" <' . $user['mail'] . '>' : '"' . Config::me('cn') . '" <' . Config::me('mail') . '>'; 
    791806                        $mail['to'] = $organizerMail; 
    792  
    793807 
    794808                        Controller::create(array('service' => 'SMTP'), $mail); 
     
    13251339                                        } 
    13261340                                    } else { 
     1341 
     1342                        ///Atualiza o Caldadav mesmo que o expresso não prescisse de atualização, pois os calendarios do caldav são independentes um de cada usuario diferente do expresso que so tem 1 evento e é compartilhado entre os usuarios 
     1343                        if (Config::module('useCaldav', 'expressoCalendar')) { //Ignorar Put dos eventos ja vindos do caldav 
     1344                            require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php'; 
     1345                            $calendars = self::schedulable2calendarToObject($schedulable['id'] , isset($params['owner']) ? $params['owner']: false ); //Busca os calendarios do usuario logado que contenham o evento 
     1346                            if (is_array($calendars)) 
     1347                                foreach ($calendars as $calendar) 
     1348                                    DAViCalAdapter::putIcal($data, array('uid' => $schedulable['uid'], 'location' => $calendar['calendar_location'])); 
     1349                        } 
     1350 
    13271351                                        if (self::_getTime($component, 'dtstamp') > $schedulable['dtstamp'] || $component->getProperty('sequence', false, false) > $schedulable['sequence']) //Organizador esta requisitando que você atualize o evento 
    13281352                                            $interation = ($isOrganizer) ? ICAL_ACTION_ORGANIZER_UPDATE : ICAL_ACTION_UPDATE; 
     
    14261450    } 
    14271451 
    1428  
    14291452    private function _getStatusTodo($id) { 
    14301453        $a = array( 
     
    14591482        return array('action' => ICAL_ACTION_IMPORT, 'type' => 'calendarIds'); 
    14601483    } 
    1461      
    1462      
     1484 
    14631485    private static function _getParticipantByMail($mail, &$participants, $isFull = false) { 
    14641486        if ($participants && $participants != '') 
     
    22452267    } 
    22462268 
     2269    private static function schedulable2calendarToObject($Schedulable, $user = false) { 
     2270        return Controller::service('PostgreSQL')->execResultSql('SELECT calendar_to_calendar_object.id as calendar_to_calendar_Object , calendar.name as calendar_name ,calendar.location as calendar_location, calendar.id as calendar_id FROM calendar_to_calendar_object , calendar , calendar_signature' 
     2271            . ' WHERE calendar_signature.user_uidnumber = ' . $user ? $user : Config::me('uidNumber') 
     2272            //      .' AND calendar_signature.is_owner = 1' 
     2273            . ' AND calendar_signature.calendar_id = calendar.id' 
     2274            . ' AND calendar_to_calendar_object.calendar_id = calendar.id' 
     2275            . ' AND calendar_to_calendar_object.calendar_object_id = ' . addslashes($Schedulable)); 
     2276    } 
    22472277} 
    22482278 
Note: See TracChangeset for help on using the changeset viewer.