fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7952] catch: send email noticifation


From: Sigurd Nes
Subject: [Fmsystem-commits] [7952] catch: send email noticifation
Date: Wed, 26 Oct 2011 13:57:03 +0000

Revision: 7952
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7952
Author:   sigurdne
Date:     2011-10-26 13:57:02 +0000 (Wed, 26 Oct 2011)
Log Message:
-----------
catch: send email noticifation

Modified Paths:
--------------
    trunk/catch/inc/custom/default/notify_by_email.php
    trunk/property/inc/cron/default/catch_ppc.php

Modified: trunk/catch/inc/custom/default/notify_by_email.php
===================================================================
--- trunk/catch/inc/custom/default/notify_by_email.php  2011-10-26 13:48:40 UTC 
(rev 7951)
+++ trunk/catch/inc/custom/default/notify_by_email.php  2011-10-26 13:57:02 UTC 
(rev 7952)
@@ -6,16 +6,19 @@
        {
                throw new Exception("notify_accounting_by_email: missing 
'notify_email' in config for this catch schema:{$schema_text}");
        }
-       else if( !$validator->check_email_address($config_data['notify_email']) 
)
+
+       $to_array = explode(',', $config_data['notify_email']);
+
+//_debug_array($to_array);
+/*
+       foreach($to_array as $_to)
        {
-               throw new Exception("notify_accounting_by_email: not a valid 
'notify_email' in config for this catch schema:{$schema_text}");
+               if( !$validator->check_email_address($_to) )
+               {
+                       throw new Exception("notify_accounting_by_email: an 
unvalid 'notify_email': {$_to} in config for schema:{$schema_text}");
+               }
        }
-
-       $to_array = array
-       (
-               $config_data['notify_email']
-       );
-                                       
+*/                                     
        $socommon               = CreateObject('property.socommon');
        $prefs = $socommon->create_preferences('property',$user_id);
 //_debug_array($prefs);
@@ -59,7 +62,14 @@
        //$body = "<a href='{$_link_to_item}'>{$subject}</a>";
        unset($_link_to_item);
 
-       $body ="<H2>Det er registrert ny post i {$schema_text}</H2>";
+       if(isset($config_data['email_message']) && 
$config_data['email_message'])
+       {
+               $body = str_replace(array('[', ']'), array('<', '>'), 
$config_data['email_message']);
+       }
+       else
+       {
+               $body ="<H2>Det er registrert ny post i {$schema_text}</H2>";
+       }
 
        $jasper_id = isset($config_data['jasper_id']) && 
$config_data['jasper_id'] ? $config_data['jasper_id'] : 0;
 
@@ -74,7 +84,7 @@
                $jasper_parameters = '';
                $_parameters = array();
 
-               $_parameters[] =  "id|{$id}";
+               $_parameters[] =  "ID|{$id}";
                $jasper_parameters = '"' . implode(';', $_parameters) . '"';
 
                unset($_parameters);

Modified: trunk/property/inc/cron/default/catch_ppc.php
===================================================================
--- trunk/property/inc/cron/default/catch_ppc.php       2011-10-26 13:48:40 UTC 
(rev 7951)
+++ trunk/property/inc/cron/default/catch_ppc.php       2011-10-26 13:57:02 UTC 
(rev 7952)
@@ -296,31 +296,7 @@
 
                                                $i++;
 
-                                               // finishing
-                                               $criteria = array
-                                               (
-                                                       'appname'       => 
'catch',
-                                                       'location'      => 
'.catch.' . str_replace('_','.',$target),
-                                                       'allrows'       => true
-                                               );
 
-                                               $custom_functions = 
$GLOBALS['phpgw']->custom_functions->find($criteria);
-
-                                               foreach ( $custom_functions as 
$entry )
-                                               {
-                                                       // prevent path 
traversal
-                                                       if ( 
preg_match('/\.\./', $entry['file_name']) )
-                                                       {
-                                                               continue;
-                                                       }
-
-                                                       $file = 
PHPGW_SERVER_ROOT . 
"/catch/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
-                                                       if ( $entry['active'] 
&& is_file($file) )
-                                                       {
-                                                               require $file;
-                                                       }
-                                               }
-                                               
                                                $ok = false;
                                                
if($this->db->transaction_commit())
                                                {
@@ -329,12 +305,41 @@
                                                                $ok = 
@rename($movefrom, $moveto);
                                                        }
                                                }
+
                                                if(!$ok)
                                                {
                                                        
$this->db->query("DELETE FROM $target_table WHERE id =" . 
(int)$id,__LINE__,__FILE__);
                                                        $i--;
                                                        
$this->receipt['error'][]=array('msg'=>lang('There was a problem moving the 
file(s), imported records are reverted'));
                                                }
+                                               else
+                                               {
+
+                                                       // finishing
+                                                       $criteria = array
+                                                       (
+                                                               'appname'       
=> 'catch',
+                                                               'location'      
=> '.catch.' . str_replace('_','.',$target),
+                                                               'allrows'       
=> true
+                                                       );
+
+                                                       $custom_functions = 
$GLOBALS['phpgw']->custom_functions->find($criteria);
+
+                                                       foreach ( 
$custom_functions as $entry )
+                                                       {
+                                                               // prevent path 
traversal
+                                                               if ( 
preg_match('/\.\./', $entry['file_name']) )
+                                                               {
+                                                                       
continue;
+                                                               }
+
+                                                               $file = 
PHPGW_SERVER_ROOT . 
"/catch/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
+                                                               if ( 
$entry['active'] && is_file($file) )
+                                                               {
+                                                                       require 
$file;
+                                                               }
+                                                       }
+                                               }
                                        }
                                }
                                
$this->receipt['message'][]=array('msg'=>lang('%1 records imported to %2', $i, 
$schema_text));




reply via email to

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