fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [9526] sms: don't die


From: Sigurd Nes
Subject: [Fmsystem-commits] [9526] sms: don't die
Date: Thu, 07 Jun 2012 07:04:25 +0000

Revision: 9526
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9526
Author:   sigurdne
Date:     2012-06-07 07:04:23 +0000 (Thu, 07 Jun 2012)
Log Message:
-----------
sms: don't die

Modified Paths:
--------------
    trunk/property/inc/class.botts.inc.php
    trunk/property/inc/class.uiproject.inc.php
    trunk/property/inc/class.uiworkorder.inc.php
    trunk/sms/inc/class.sms.inc.php

Modified: trunk/property/inc/class.botts.inc.php
===================================================================
--- trunk/property/inc/class.botts.inc.php      2012-06-07 06:35:14 UTC (rev 
9525)
+++ trunk/property/inc/class.botts.inc.php      2012-06-07 07:04:23 UTC (rev 
9526)
@@ -1195,27 +1195,37 @@
                                )
                        );
 
-                       $sms_text = "{$subject}. 
\r\n{$GLOBALS['phpgw_info']['user']['fullname']} 
\r\n{$GLOBALS['phpgw_info']['user']['preferences']['property']['email']}";
-                       $sms    = CreateObject('sms.sms');
+                       if(isset($GLOBALS['phpgw_info']['user']['apps']['sms']))
+                       {
 
+                               $sms_text = "{$subject}. 
\r\n{$GLOBALS['phpgw_info']['user']['fullname']} 
\r\n{$GLOBALS['phpgw_info']['user']['preferences']['property']['email']}";
+                               $sms    = CreateObject('sms.sms');
+
+                               foreach($notify_list as $entry)
+                               {
+                                       if($entry['is_active'] && 
$entry['notification_method'] == 'sms' && $entry['sms'])
+                                       {
+                                               
$sms->websend2pv($this->account,$entry['sms'],$sms_text);
+                                               $toarray_sms[] = 
"{$entry['first_name']} {$entry['last_name']}({$entry['sms']})";
+                                               
$receipt['message'][]=array('msg'=>lang('%1 is 
notified',"{$entry['first_name']} {$entry['last_name']}"));
+                                       }
+                               }
+                               unset($entry);
+                               if($toarray_sms)
+                               {
+                                       
$this->historylog->add('MS',$id,"{$subject}::" . implode(',',$toarray_sms));    
                                        
+                               }
+                       }
+
+                       reset($notify_list);
                        foreach($notify_list as $entry)
                        {
                                if($entry['is_active'] && 
$entry['notification_method'] == 'email' && $entry['email'])
                                {
                                        $toarray[] = "{$entry['first_name']} 
{$entry['last_name']}<{$entry['email']}>";
                                }
-                               else if($entry['is_active'] && 
$entry['notification_method'] == 'sms' && $entry['sms'])
-                               {
-                                       
$sms->websend2pv($this->account,$entry['sms'],$sms_text);
-                                       $toarray_sms[] = 
"{$entry['first_name']} {$entry['last_name']}({$entry['sms']})";
-                                       
$receipt['message'][]=array('msg'=>lang('%1 is 
notified',"{$entry['first_name']} {$entry['last_name']}"));
-                               }
                        }
                        unset($entry);
-                       if($toarray_sms)
-                       {
-                               $this->historylog->add('MS',$id,"{$subject}::" 
. implode(',',$toarray_sms));                                            
-                       }
 
                        if($toarray)
                        {

Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php  2012-06-07 06:35:14 UTC (rev 
9525)
+++ trunk/property/inc/class.uiproject.inc.php  2012-06-07 07:04:23 UTC (rev 
9526)
@@ -1317,29 +1317,39 @@
                                                        );
                                                
                                                        $subject=lang('project 
%1 has been edited',$id);
-                                                       $sms_text = 
"{$subject}. \r\n{$GLOBALS['phpgw_info']['user']['fullname']} 
\r\n{$GLOBALS['phpgw_info']['user']['preferences']['property']['email']}";
-                                                       $sms    = 
CreateObject('sms.sms');
 
+                                                       
if(isset($GLOBALS['phpgw_info']['user']['apps']['sms']))
+                                                       {
+                                                               $sms_text = 
"{$subject}. \r\n{$GLOBALS['phpgw_info']['user']['fullname']} 
\r\n{$GLOBALS['phpgw_info']['user']['preferences']['property']['email']}";
+                                                               $sms    = 
CreateObject('sms.sms');
+
+                                                               
foreach($notify_list as $entry)
+                                                               {
+                                                                       
if($entry['is_active'] && $entry['notification_method'] == 'sms' && 
$entry['sms'])
+                                                                       {
+                                                                               
$sms->websend2pv($this->account,$entry['sms'],$sms_text);
+                                                                               
$toarray_sms[] = "{$entry['first_name']} 
{$entry['last_name']}({$entry['sms']})";
+                                                                               
$receipt['message'][]=array('msg'=>lang('%1 is 
notified',"{$entry['first_name']} {$entry['last_name']}"));
+                                                                       }
+                                                               }
+                                                               unset($entry);
+       
+                                                               if($toarray_sms)
+                                                               {
+                                                                       
$historylog->add('MS',$id,implode(',',$toarray_sms));                           
                
+                                                               }
+                                                       }
+                                               
+                                                       reset($notify_list);
                                                        foreach($notify_list as 
$entry)
                                                        {
                                                                
if($entry['is_active'] && $entry['notification_method'] == 'email' && 
$entry['email'])
                                                                {
                                                                        
$toarray[] = "{$entry['first_name']} {$entry['last_name']}<{$entry['email']}>";
                                                                }
-                                                               else 
if($entry['is_active'] && $entry['notification_method'] == 'sms' && 
$entry['sms'])
-                                                               {
-                                                                       
$sms->websend2pv($this->account,$entry['sms'],$sms_text);
-                                                                       
$toarray_sms[] = "{$entry['first_name']} 
{$entry['last_name']}({$entry['sms']})";
-                                                                       
$receipt['message'][]=array('msg'=>lang('%1 is 
notified',"{$entry['first_name']} {$entry['last_name']}"));
-                                                               }
                                                        }
                                                        unset($entry);
 
-                                                       if($toarray_sms)
-                                                       {
-                                                               
$historylog->add('MS',$id,implode(',',$toarray_sms));                           
                
-                                                       }
-                                               
                                                        if ($toarray)
                                                        {
                                                                $to = 
implode(';',$toarray);

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2012-06-07 06:35:14 UTC 
(rev 9525)
+++ trunk/property/inc/class.uiworkorder.inc.php        2012-06-07 07:04:23 UTC 
(rev 9526)
@@ -1183,28 +1183,31 @@
                                        );
 
                                        $subject=lang('workorder %1 has been 
edited',$id);
-                                       $sms_text = "{$subject}. 
\r\n{$GLOBALS['phpgw_info']['user']['fullname']} 
\r\n{$GLOBALS['phpgw_info']['user']['preferences']['property']['email']}";
-                                       $sms    = CreateObject('sms.sms');
+                                       
if(isset($GLOBALS['phpgw_info']['user']['apps']['sms']))
+                                       {
+                                               $sms_text = "{$subject}. 
\r\n{$GLOBALS['phpgw_info']['user']['fullname']} 
\r\n{$GLOBALS['phpgw_info']['user']['preferences']['property']['email']}";
+                                               $sms    = 
CreateObject('sms.sms');
 
-                                       foreach($notify_list as $entry)
-                                       {
-                                               if($entry['is_active'] && 
$entry['notification_method'] == 'email' && $entry['email'])
+                                               foreach($notify_list as $entry)
                                                {
-                                                       $toarray[] = 
"{$entry['first_name']} {$entry['last_name']}<{$entry['email']}>";
+                                                       if($entry['is_active'] 
&& $entry['notification_method'] == 'email' && $entry['email'])
+                                                       {
+                                                               $toarray[] = 
"{$entry['first_name']} {$entry['last_name']}<{$entry['email']}>";
+                                                       }
+                                                       else 
if($entry['is_active'] && $entry['notification_method'] == 'sms' && 
$entry['sms'])
+                                                       {
+                                                               
$sms->websend2pv($this->account,$entry['sms'],$sms_text);
+                                                               $toarray_sms[] 
= "{$entry['first_name']} {$entry['last_name']}({$entry['sms']})";
+                                                               
$receipt['message'][]=array('msg'=>lang('%1 is 
notified',"{$entry['first_name']} {$entry['last_name']}"));
+                                                       }
                                                }
-                                               else if($entry['is_active'] && 
$entry['notification_method'] == 'sms' && $entry['sms'])
+                                               unset($entry);
+
+                                               if($toarray_sms)
                                                {
-                                                       
$sms->websend2pv($this->account,$entry['sms'],$sms_text);
-                                                       $toarray_sms[] = 
"{$entry['first_name']} {$entry['last_name']}({$entry['sms']})";
-                                                       
$receipt['message'][]=array('msg'=>lang('%1 is 
notified',"{$entry['first_name']} {$entry['last_name']}"));
+                                                       
$historylog->add('MS',$id,implode(',',$toarray_sms));                           
                
                                                }
                                        }
-                                       unset($entry);
-
-                                       if($toarray_sms)
-                                       {
-                                               
$historylog->add('MS',$id,implode(',',$toarray_sms));                           
                
-                                       }
                                                
                                        if ($toarray)
                                        {

Modified: trunk/sms/inc/class.sms.inc.php
===================================================================
--- trunk/sms/inc/class.sms.inc.php     2012-06-07 06:35:14 UTC (rev 9525)
+++ trunk/sms/inc/class.sms.inc.php     2012-06-07 07:04:23 UTC (rev 9526)
@@ -59,7 +59,7 @@
                }
                else
                {
-//                     die("ERROR: No selected gateway module available - 
please contact system administrator");
+                       die("ERROR: No selected gateway module available - 
please contact system administrator");
                }
        }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]