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

File:
1 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 
Note: See TracChangeset for help on using the changeset viewer.