Changeset 8256


Ignore:
Timestamp:
11/24/13 19:27:07 (10 years ago)
Author:
cristiano
Message:

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

File:
1 edited

Legend:

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

    r7959 r8256  
    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                                //$pv['user']['mail'] = str_replace('@correiolivre.caixa','@caixa.gov.br',$pv['user']['mail']);                                    
     501                         
     502                        $vevent->setProperty('organizer', $pv['user']['mail'], array('CN' => $pv['user']['name'])); 
     503                }else { 
    500504                    $pParams = array(); 
    501505                    $pParams['CN'] = $pv['user']['name']; 
     
    618622                        if (self::_getTime($component, 'dtstamp') > $schedulable['dtstamp'] || $component->getProperty('sequence', false, false) > $schedulable['sequence']){ //Organizador esta requisitando que você atualize o evento 
    619623 
     624 
    620625                            $params['calendar'] = $params['calendar'] == 'true' ? $calendar : $params['calendar']; 
    621626                            $interation = self::_makeVEVENT($schedulable, $component, $params); 
     
    642647                    $interation = self::_makeVEVENT(array(), $component, $params); 
    643648 
    644                     if (strpos($params['prodid'], 'kigkonsult.se') !== false) { //envia notificação para fora 
     649                       if (strpos($params['prodid'], 'kigkonsult.se') !== false) { //envia notificação para fora 
    645650 
    646651                        /* Data de Inicio */ 
     
    693698 
    694699 
     700 
    695701                        if ($uid = $component->getProperty('uid', false, false)) 
    696702                        ; 
     
    710716 
    711717 
     718 
     719 
    712720                        if ($property = $component->getProperty('organizer', FALSE, TRUE)) { 
    713721                        $participant = array(); 
     
    733741                        $sc['participants'][] = $participant; 
    734742                        } 
     743 
    735744 
    736745 
     
    749758                        $sc['participants'][] = $participant; 
    750759                        $sc['type'] = EVENT_ID; 
     760 
    751761 
    752762 
     
    801811                            break; 
    802812                        } 
     813 
    803814                        require_once ROOTPATH . '/api/parseTPL.php'; 
    804815 
     
    12281239                    foreach ($schedulable['participants'] as $value){ 
    12291240 
     1241 
    12301242                        if ($value['user']['id'] == $params['owner']) { 
    12311243                            $isParticipant = true; 
     
    14291441 
    14301442 
     1443 
    14311444        return $offset; 
    14321445    } 
     
    14571470    } 
    14581471 
     1472 
    14591473    private function _getStatusTodo($id) { 
    14601474        $a = array( 
     
    14671481    return isset($a[$id]) ? $a[$id] : 'NEED_ACTION'; 
    14681482    } 
     1483 
    14691484 
    14701485    private static function _checkParticipantByPermissions($schedulable) { 
     
    15831598 
    15841599    static private function _makeVEVENT($schedulable, $component, $params) { 
     1600 
     1601 
    15851602        $interation = array(); 
    15861603        $eventID = isset($schedulable['id']) ? $schedulable['id'] : mt_rand() . '(Formatter)'; 
     
    16411658 
    16421659 
     1660 
    16431661        $schedulable['summary'] = mb_convert_encoding($component->getProperty('summary', false, false), 'ISO-8859-1', 'UTF-8,ISO-8859-1'); 
    16441662 
     
    16501668        if ($location = $component->getProperty('location', false, false)) 
    16511669            $schedulable['location'] = mb_convert_encoding($location, 'ISO-8859-1', 'UTF-8,ISO-8859-1'); 
     1670 
    16521671 
    16531672 
     
    16941713            $participant['schedulable'] = $eventID; 
    16951714 
    1696             if (isset($params['status']) && $mailUser == Config::me('mail')) 
     1715            if (isset($params['status']) &&  ltrim( substr( $mailUser, 0 , strpos( $mailUser, '@' ) ), '@' )  ==  ltrim( substr( Config::me('mail'), 0, strpos( Config::me('mail'), '@' ) ), '@' )) 
    16971716                $participant['status'] = $params['status']; 
    16981717            else 
    16991718                $participant['status'] = (isset($property['params']['PARTSTAT']) && constant('STATUS_' . $property['params']['PARTSTAT']) !== null ) ? constant('STATUS_' . $property['params']['PARTSTAT']) : STATUS_UNANSWERED; 
    1700  
    17011719 
    17021720            $participant['isOrganizer'] = '0'; 
     
    17311749 
    17321750 
     1751 
    17331752            if($participant = self::_getParticipantByMail($mailUser, $schedulable['participants'], true)){ 
    17341753 
     
    17481767            /* Verifica se este usuario é um usuario interno do ldap */ 
    17491768            $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) { 
     1769 
     1770            $user = null; 
     1771            if ($intUser && count($intUser) > 0 && $intUser[0]['id']) { 
    17521772                $participant['isExternal'] = isset($intUser[0]['isExternal']) ? $intUser[0]['isExternal'] : 0; 
    17531773                $participant['user'] = $intUser[0]['id']; 
     
    19421962        $schedulable['summary'] = mb_convert_encoding($component->getProperty('summary', false, false), 'ISO-8859-1', 'UTF-8,ISO-8859-1'); 
    19431963 
     1964 
    19441965        /* Definindo Description */ 
    19451966        if ($desc = $component->getProperty('description', false, false)) 
     
    21442165        $interation['schedulable://' . $todoID] = $schedulable; 
    21452166 
     2167 
     2168 
    21462169    return $interation; 
    21472170    } 
     
    21632186                foreach ($sig2 as $val) 
    21642187                    $calendars[] = $val['calendar']; 
     2188 
    21652189 
    21662190 
Note: See TracChangeset for help on using the changeset viewer.