Changeset 8257


Ignore:
Timestamp:
11/25/13 01:47:25 (10 years ago)
Author:
douglas
Message:

Ticket #3501 - Nao sensibilizacao de status apos importacao de evento

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.5/prototype/services/iCal.php

    r8232 r8257  
    495495            $isResponseDelegated = false; 
    496496            if ((isset($pv['delegatedFrom']) && $pv['delegatedFrom'] == 0) || !isset($pv['delegatedFrom']))  { 
    497                 if ($pv['isOrganizer'] == 1) 
    498                     $vevent->setProperty('organizer', $pv['user']['mail'], array('CN' => $pv['user']['name'])); 
    499                 else { 
     497                if ($pv['isOrganizer'] == 1){  
     498                        if($pv['user']['id'] == Config::me('uidNumber'))  
     499                                $pv['user']['mail'] = $pv['user']['mailSenderAddress'];  
     500                          
     501                        $vevent->setProperty('organizer', $pv['user']['mail'], array('CN' => $pv['user']['name']));  
     502                }else {  
    500503                    $pParams = array(); 
    501504                    $pParams['CN'] = $pv['user']['name']; 
     
    618621                        if (self::_getTime($component, 'dtstamp') > $schedulable['dtstamp'] || $component->getProperty('sequence', false, false) > $schedulable['sequence']){ //Organizador esta requisitando que você atualize o evento 
    619622 
     623  
    620624                            $params['calendar'] = $params['calendar'] == 'true' ? $calendar : $params['calendar']; 
    621625                            $interation = self::_makeVEVENT($schedulable, $component, $params); 
     
    642646                    $interation = self::_makeVEVENT(array(), $component, $params); 
    643647 
    644                     if (strpos($params['prodid'], 'kigkonsult.se') !== false) { //envia notificação para fora 
     648                       if (strpos($params['prodid'], 'kigkonsult.se') !== false) { //envia notificação para fora 
    645649 
    646650                        /* Data de Inicio */ 
     
    693697 
    694698 
     699  
    695700                        if ($uid = $component->getProperty('uid', false, false)) 
    696701                        ; 
     
    710715 
    711716 
     717  
     718  
    712719                        if ($property = $component->getProperty('organizer', FALSE, TRUE)) { 
    713720                        $participant = array(); 
     
    733740                        $sc['participants'][] = $participant; 
    734741                        } 
     742  
    735743 
    736744 
     
    749757                        $sc['participants'][] = $participant; 
    750758                        $sc['type'] = EVENT_ID; 
     759  
    751760 
    752761 
     
    801810                            break; 
    802811                        } 
     812  
    803813                        require_once ROOTPATH . '/api/parseTPL.php'; 
    804814 
     
    12281238                    foreach ($schedulable['participants'] as $value){ 
    12291239 
     1240  
    12301241                        if ($value['user']['id'] == $params['owner']) { 
    12311242                            $isParticipant = true; 
     
    14291440 
    14301441 
     1442  
    14311443        return $offset; 
    14321444    } 
     
    14571469    } 
    14581470 
     1471  
    14591472    private function _getStatusTodo($id) { 
    14601473        $a = array( 
     
    14671480    return isset($a[$id]) ? $a[$id] : 'NEED_ACTION'; 
    14681481    } 
     1482  
    14691483 
    14701484    private static function _checkParticipantByPermissions($schedulable) { 
     
    15831597 
    15841598    static private function _makeVEVENT($schedulable, $component, $params) { 
     1599  
     1600  
    15851601        $interation = array(); 
    15861602        $eventID = isset($schedulable['id']) ? $schedulable['id'] : mt_rand() . '(Formatter)'; 
     
    16411657 
    16421658 
     1659  
    16431660        $schedulable['summary'] = mb_convert_encoding($component->getProperty('summary', false, false), 'ISO-8859-1', 'UTF-8,ISO-8859-1'); 
    16441661 
     
    16501667        if ($location = $component->getProperty('location', false, false)) 
    16511668            $schedulable['location'] = mb_convert_encoding($location, 'ISO-8859-1', 'UTF-8,ISO-8859-1'); 
     1669  
    16521670 
    16531671 
     
    16941712            $participant['schedulable'] = $eventID; 
    16951713 
    1696             if (isset($params['status']) && $mailUser == Config::me('mail')) 
     1714            if (isset($params['status']) &&  ltrim( substr( $mailUser, 0 , strpos( $mailUser, '@' ) ), '@' )  ==  ltrim( substr( Config::me('mail'), 0, strpos( Config::me('mail'), '@' ) ), '@' )) 
    16971715                $participant['status'] = $params['status']; 
    16981716            else 
    16991717                $participant['status'] = (isset($property['params']['PARTSTAT']) && constant('STATUS_' . $property['params']['PARTSTAT']) !== null ) ? constant('STATUS_' . $property['params']['PARTSTAT']) : STATUS_UNANSWERED; 
    1700  
    17011718 
    17021719            $participant['isOrganizer'] = '0'; 
     
    17311748 
    17321749 
     1750  
    17331751            if($participant = self::_getParticipantByMail($mailUser, $schedulable['participants'], true)){ 
    17341752 
     
    17481766            /* Verifica se este usuario é um usuario interno do ldap */ 
    17491767            $intUser = Controller::find(array('concept' => 'user'), array('id', 'isExternal'), array('filter' => array('OR', array('=', 'mail', $mailUser), array('=', 'mailAlternateAddress', $mailUser)))); 
    1750             $user = null; 
    1751             if ($intUser && count($intUser) > 0) { 
     1768  
     1769            $user = null;  
     1770            if ($intUser && count($intUser) > 0 && $intUser[0]['id']) {  
    17521771                $participant['isExternal'] = isset($intUser[0]['isExternal']) ? $intUser[0]['isExternal'] : 0; 
    17531772                $participant['user'] = $intUser[0]['id']; 
     
    19421961        $schedulable['summary'] = mb_convert_encoding($component->getProperty('summary', false, false), 'ISO-8859-1', 'UTF-8,ISO-8859-1'); 
    19431962 
     1963  
    19441964        /* Definindo Description */ 
    19451965        if ($desc = $component->getProperty('description', false, false)) 
     
    21442164        $interation['schedulable://' . $todoID] = $schedulable; 
    21452165 
     2166  
     2167  
    21462168    return $interation; 
    21472169    } 
     
    21632185                foreach ($sig2 as $val) 
    21642186                    $calendars[] = $val['calendar']; 
     2187  
    21652188 
    21662189 
Note: See TracChangeset for help on using the changeset viewer.