Changeset 1720


Ignore:
Timestamp:
11/27/09 15:43:28 (14 years ago)
Author:
eduardoalex
Message:

Ticket #682 - Adicionada verificacao se o delegado ja esta no evento

Location:
trunk/calendar/inc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/calendar/inc/class.bocalendar.inc.php

    r1576 r1720  
    383383 
    384384                        $this->so->cal->stream->lock(array("phpgw_cal_user")); 
    385                         $sql = "update phpgw_cal_user set cal_login = $idDelegado,cal_status='U' where cal_id=$idEvento  
    386                                         and cal_login=$idDelegador"; 
    387  
    388                         $this->so->cal->stream->query($sql,__LINE__,__FILE__,0,-1,true); 
    389  
     385                        $sql = "SELECT * FROM phpgw_cal_user where cal_id=$idEvento and cal_login=$idDelegado"; 
     386                         
     387                        $this->so->cal->stream->query($sql,__LINE__,__FILE__); 
     388                        if($this->so->cal->stream->next_record()) 
     389                        { 
     390                                throw new Exception("The selected User is already included in this event"); 
     391                        }else{ 
     392                                $sql = "update phpgw_cal_user set cal_login = $idDelegado,cal_status='U' where cal_id=$idEvento  
     393                                                and cal_login=$idDelegador"; 
     394 
     395                                $this->so->cal->stream->query($sql,__LINE__,__FILE__,0,-1,true); 
     396                                 
     397                                $event = $this->so->read_entry($idEvento); 
     398 
     399                                $this->send_update(MSG_ADDED,array($idDelegado => 'U'),$event,$event); 
     400                        } 
    390401                        $this->so->cal->stream->unlock(); 
    391                         $event = $this->so->read_entry($idEvento); 
    392                         /*foreach($event as $id=>$value) 
    393                                 echo "<br>".$id."  --  ".$value; 
    394                         exit(0);*/ 
    395                         $this->send_update(MSG_ADDED,array($idDelegado => 'U'),$event,$event); 
    396402                } 
    397403 
  • trunk/calendar/inc/class.uicalendar.inc.php

    r1670 r1720  
    232232 
    233233                function delegate_event($params=NULL) { 
    234                         //$ldap = CreateObject('expressoMail1_2.ldap_functions'); 
    235                         //$delegated = $ldap->uid2uidnumber($_REQUEST['delegated']); 
    236 system('echo "request[date]: '.$_REQUEST['date'].'" >>/tmp/controle'); 
     234                        $ldap = CreateObject('expressoMail1_2.ldap_functions'); 
     235                        $delegated = $ldap->uid2uidnumber($_REQUEST['delegated']); 
     236 
    237237                        try { 
    238                                 $this->bo->delegar($_REQUEST['delegator'],$_REQUEST['delegated']/*$delegated*/,$_REQUEST['event']); 
     238                                $this->bo->delegar($_REQUEST['delegator'],$ldap->uid2uidnumber($_REQUEST['delegated'])/*$delegated*/,$_REQUEST['event']); 
    239239                                header("Location: index.php?menuaction=calendar.uicalendar.day&date=".$_REQUEST['date']); 
    240240                        }catch(Exception $e) { 
    241241                                header("Location: index.php?menuaction=calendar.uicalendar.screen_delegate_event&id_event=". $_REQUEST["event"]."&delegator=".$_REQUEST["delegator"]."&date=".$_REQUEST["date"]."&error=1"); 
    242242                        } 
    243  
    244  
    245243                } 
    246244 
Note: See TracChangeset for help on using the changeset viewer.