Changeset 2230


Ignore:
Timestamp:
03/11/10 18:18:26 (14 years ago)
Author:
rafaelraymundo
Message:

Ticket #799 - Correcao de erro ao delegar um evento sem selecionar usuário

Location:
trunk/calendar
Files:
3 edited

Legend:

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

    r1949 r2230  
    384384                        $this->so->cal->stream->lock(array("phpgw_cal_user")); 
    385385                        $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  
     386 
     387                        if($idDelegado != '') 
     388                        { 
     389                                $this->so->cal->stream->query($sql,__LINE__,__FILE__); 
     390                                if($this->so->cal->stream->next_record()) 
     391                                { 
     392                                        throw new Exception("The selected User is already included in this event"); 
     393                                }else{ 
     394                                        $sql = "update phpgw_cal_user set cal_login = $idDelegado,cal_status='U' where cal_id=$idEvento  
    393395                                                and cal_login=$idDelegador"; 
    394396 
    395                                 $this->so->cal->stream->query($sql,__LINE__,__FILE__,0,-1,true); 
     397                                        $this->so->cal->stream->query($sql,__LINE__,__FILE__,0,-1,true); 
    396398                                 
    397                                 $event = $this->so->read_entry($idEvento); 
    398  
    399                                 $this->send_update(MSG_ADDED,array($idDelegado => 'U'),$event,$event); 
    400                         } 
     399                                        $event = $this->so->read_entry($idEvento); 
     400 
     401                                        $this->send_update(MSG_ADDED,array($idDelegado => 'U'),$event,$event); 
     402                                } 
     403                        }else { 
     404                                throw new Exception('999'); 
     405                        } 
     406 
    401407                        $this->so->cal->stream->unlock(); 
    402408                } 
  • trunk/calendar/inc/class.uicalendar.inc.php

    r1999 r2230  
    218218 
    219219                        if(isset($_REQUEST["error"])) 
    220                                 $var['error_msg'] = lang("Problems delegating. Make sure you haven't delegated to a person that was also invited to the meeting"); 
     220                        { 
     221                                if($_REQUEST["error"] == 999){ 
     222                                        $var['error_msg'] = lang("Problems delegating. Make sure you have selected a user to delegate the appointment."); 
     223                                }else { 
     224                                        $var['error_msg'] = lang("Problems delegating. Make sure you haven't delegated to a person that was also invited to the meeting"); 
     225                                } 
     226                        } 
    221227 
    222228                        $template = CreateObject('phpgwapi.Template',$this->template_dir); 
     
    239245                                header("Location: index.php?menuaction=calendar.uicalendar.day&date=".$_REQUEST['date']); 
    240246                        }catch(Exception $e) { 
    241                                 header("Location: index.php?menuaction=calendar.uicalendar.screen_delegate_event&id_event=". $_REQUEST["event"]."&delegator=".$_REQUEST["delegator"]."&date=".$_REQUEST["date"]."&error=1"); 
     247                                if($e->getMessage() == '999') { 
     248                                        header("Location: index.php?menuaction=calendar.uicalendar.screen_delegate_event&id_event=". $_REQUEST["event"]."&delegator=".$_REQUEST["delegator"]."&date=".$_REQUEST["date"]."&error=999"); 
     249                                }else { 
     250                                        header("Location: index.php?menuaction=calendar.uicalendar.screen_delegate_event&id_event=". $_REQUEST["event"]."&delegator=".$_REQUEST["delegator"]."&date=".$_REQUEST["date"]."&error=1"); 
     251                                } 
    242252                        } 
    243253                } 
Note: See TracChangeset for help on using the changeset viewer.