phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/inc/class.uiproject.inc.php, 1.4


From: nomail
Subject: [Phpgroupware-cvs] property/inc/class.uiproject.inc.php, 1.4
Date: Thu, 1 Jul 2004 10:15:08 +0200

Update of /property/inc
Modified Files:
        Branch: 
          class.uiproject.inc.php

date: 2004/07/01 08:15:08;  author: sigurdne;  state: Exp;  lines: +58 -39

Log Message:
no message
=====================================================================
Index: property/inc/class.uiproject.inc.php
diff -u property/inc/class.uiproject.inc.php:1.3 
property/inc/class.uiproject.inc.php:1.4
--- property/inc/class.uiproject.inc.php:1.3    Wed Jun 30 18:02:37 2004
+++ property/inc/class.uiproject.inc.php        Thu Jul  1 08:15:08 2004
@@ -657,11 +657,11 @@
 
                                        if ($values['approval'] && 
$values['mail_address'])
                                        {
-                                               
$coordinator_name=$GLOBALS['phpgw_info']['user']['fullname'];
-                                               
$coordinator_email=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['email'];
-                                               $headers = "Return-Path: <". 
$coordinator_email .">\r\n";
-                                               $headers .= "From: " . 
$coordinator_name . "<" . $coordinator_email .">\r\n";
-                                               $headers .= "Bcc: " . 
$coordinator_name . "<" . $coordinator_email .">\r\n";
+                                               
$from_name=$GLOBALS['phpgw_info']['user']['fullname'];
+                                               
$from_email=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['email'];
+                                               $headers = "Return-Path: <". 
$from_email .">\r\n";
+                                               $headers .= "From: " . 
$from_name . "<" . $from_email .">\r\n";
+                                               $headers .= "Bcc: " . 
$from_name . "<" . $from_email .">\r\n";
                                                $headers .= "Content-type: 
text/plain; charset=iso-8859-1\r\n";
 
                                                $subject = lang(Approval).": ". 
$values['project_id'];
@@ -670,9 +670,25 @@
                                                $mail_method= 
$config->config_data['fmwrkorder_mail'];
                                                if ($mail_method=='smtp'):
                                                {
-                                                       $bcc = 
$coordinator_email;
-                                                       $send = 
CreateObject('phpgwapi.send');
-                                                       $rcpt = 
$send->msg('email',$values['mail_address'], $subject, stripslashes($message), 
'', $cc, $bcc, $coordinator_email, $coordinator_name, 'plain');
+                                                       $bcc = $from_email;
+                                                       if 
(!is_object($GLOBALS['phpgw']->send))
+                                                       {
+                                                               
$GLOBALS['phpgw']->send = CreateObject('phpgwapi.send');
+                                                       }
+
+                                                       $rcpt = 
$GLOBALS['phpgw']->send->msg('email',$values['mail_address'], $subject, 
stripslashes($message), '', $cc, $bcc, $from_email, $from_name, 'plain');
+
+                                                       if(!$rcpt)
+                                                       {
+                                                               
$receipt['error'][]=array('msg'=>"uiproject::edit: sending message to '" . 
$values['mail_address'] . "', subject='$subject' failed !!!");
+                                                               
$receipt['error'][]=array('msg'=> $GLOBALS['phpgw']->send->err['desc']);
+                                                               
$bypass_error=True;
+                                                       }
+                                                       else
+                                                       {
+                                                               
$receipt['message'][]=array('msg'=>lang('%1 is 
notified',$values['mail_address']));
+                                                       }
+
                                                }
                                                elseif 
($mail_method=='sendmail'):
                                                {
@@ -681,37 +697,12 @@
                                                else:
                                                {
                                                        
$receipt['error'][]=array('msg'=>lang('Mailing method is not chosen! (admin 
section)'));
+                                                       $bypass_error=True;
                                                }
                                                endif;
                                        }
 
-                                       if($rcpt)
-                                       {
-                                               
$receipt['message'][]=array('msg'=>lang('%1 is 
notified',$values['mail_address']));
-                                       }
-                               }
-
-                               if($receipt['error'])
-                               {
-                                       if($values['location'])
-                                       {
-                                               $location_code=implode("-", 
$values['location']);
-                                               $values['location_data'] = 
$bolocation->read_single($location_code,$values['extra']);
-                                       }
-
-                                       if($values['extra']['p_num'])
-                                       {
-                                               
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
-                                               
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
-                                               
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
-                                               
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
-                                       }
                                }
-                       }
-
-                       if(((!$receipt['error'] || $add_request) && !$bypass) 
&& $id)
-                       {
-                               $values = $this->bo->read_single($id);
 
                                if (isset($receipt['notice_owner']) AND 
is_array($receipt['notice_owner']))
                                {
@@ -721,21 +712,28 @@
                                                $prefs_coordinator = 
$this->bocommon->create_preferences($this->currentapp,$values['coordinator']);
                                                $to = 
$prefs_coordinator['email'];
 
+                                               
$from_name=$GLOBALS['phpgw_info']['user']['fullname'];
+                                               
$from_email=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['email'];
+
                                                
foreach($receipt['notice_owner'] as $notice)
                                                {
                                                        $body .= $notice . "\n";
                                                }
 
+                                               $body .= lang('Altered by') . 
': ' . $from_name . "\n";
+
                                                if 
(!is_object($GLOBALS['phpgw']->send))
                                                {
                                                        $GLOBALS['phpgw']->send 
= CreateObject('phpgwapi.send');
                                                }
-                                               $returncode = 
$GLOBALS['phpgw']->send->msg('email',$to,$subject=lang('Project %1 is 
altered',$id),$body);
+
+                                               $returncode = 
$GLOBALS['phpgw']->send->msg('email',$to,$subject=lang('Project %1 is 
altered',$id),$body, False,False,False, $from_email, $from_name, 'plain');
 
                                                if (!$returncode)       // not 
nice, but better than failing silently
                                                {
-                                                       echo 
"<p>bocalendar::send_update: sending message to '$to' subject='$subject' failed 
!!!<br>\n";
-                                                       echo 
$GLOBALS['phpgw']->send->err['desc']."</p>\n";
+                                                       
$receipt['error'][]=array('msg'=>"uiproject::edit: sending message to '$to' 
subject='$subject' failed !!!");
+                                                       
$receipt['error'][]=array('msg'=> $GLOBALS['phpgw']->send->err['desc']);
+                                                       $bypass_error=True;
                                                }
                                                else
                                                {
@@ -745,6 +743,28 @@
                                }
 
 
+                               if($receipt['error'] && !$bypass_error)
+                               {
+                                       if($values['location'])
+                                       {
+                                               $location_code=implode("-", 
$values['location']);
+                                               $values['location_data'] = 
$bolocation->read_single($location_code,$values['extra']);
+                                       }
+
+                                       if($values['extra']['p_num'])
+                                       {
+                                               
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
+                                               
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
+                                               
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
+                                               
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
+                                       }
+                               }
+                       }
+
+                       if($bypass_error || ((!$receipt['error'] || 
$add_request) && !$bypass) && $id)
+                       {
+                               $values = $this->bo->read_single($id);
+
                                if(!$values['workorder_budget'] && $save)
                                {
                                        
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit&project_id='
 . $id);
@@ -779,8 +799,7 @@
                                'lang_workorder_id'     => lang('Workorder'),
                                'lang_budget'           => lang('Budget'),
                                'lang_calculation'      => lang('Calculation'),
-                               'lang_vendor'   => lang('Vendor'),
-                               'lang_email'    => lang('Email')
+                               'lang_vendor'   => lang('Vendor')
                        );
 
                        if ($id)




reply via email to

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