Re: change to Driver.php

Bo Daley <[email protected]>
Newsgroups gmane.comp.horde.whups
Message-ID <[email protected]>
Quoting Chuck Hagenbuch <[email protected]>:

> Yes; if you could add support for arrays here, that would be great. Please
> include the patch to conf.php.dist as well.



cool actually the array simplifies the logic in Driver.php a bit:


Index: Driver.php
===================================================================
RCS file: /repository/whups/lib/Driver.php,v
retrieving revision 1.40
diff -u -r1.40 Driver.php
--- Driver.php  4 Feb 2003 21:33:09 -0000       1.40
+++ Driver.php  20 Mar 2003 05:35:42 -0000
@@ -173,22 +173,16 @@
 
     function _sendMails($who, $ticket_id, $subject, $message, $from)
     {
-        switch ($who) {
-        case 'all':
-            $this->_mail($ticket_id, $this->getListeners($ticket_id, true,
true, true),
-                         $subject, $message, $from);
-            break;
-
-        case 'requester':
-            $this->_mail($ticket_id, $this->getListeners($ticket_id, false,
true, false),
-                         $subject, $message, $from);
-            break;
-
-        case 'owner':
-            $this->_mail($ticket_id, $this->getListeners($ticket_id, true,
false, false),
-                         $subject, $message, $from);
-            break;
+        $withresponsible = false;
+        $withrequester = false;
+        $withowner = false;
+        foreach ($who as $key=>$val) {
+            if ($val == 'all') { $withresponsible = true; }
+            if ($val == 'requester') { $withrequester = true; }
+            if ($val == 'owner') { $withowner = true; }
         }
+        $this->_mail($ticket_id, $this->getListeners($ticket_id, $withowner,
$withrequester, $withresponsible),
+                    $subject, $message, $from);
     }
 
     function _formatComments($comments)
@@ -200,6 +194,7 @@
                                                  
Whups::formatUser($comment['user_id_creator']),
                                                  
Horde_Form_Type_date::getFormattedTimeFull($comment['timestamp'])));
             $text .= "\n" . $this->_splitMessage($comment['comment_text']) . "\n";
+            $text .= "\n--------------------\n";
         }
 
         return $text;



And here is the patch for conf.php.dist:


Index: conf.php.dist
===================================================================
RCS file: /repository/whups/config/conf.php.dist,v
retrieving revision 1.15
diff -u -r1.15 conf.php.dist
--- conf.php.dist       13 Feb 2003 04:28:52 -0000      1.15
+++ conf.php.dist       20 Mar 2003 05:38:52 -0000
@@ -53,25 +53,31 @@
 //  'revchronological' - All comments, most recent comments first.
 $conf['mail']['commenthistory'] = 'new';
 
-// Should we send mail on ticket creation? Set to 'all', 'requester',
-// or 'none',
-$conf['mail']['oncreate'] = 'requester';
+// Should we send mail on ticket creation? 
+// Set to any combination of 'all', 'requester' or 'none' (empty array)
+// where 'all' is all users responsible for this module
+// eg $conf['mail']['oncreate'] = array('requester','all');
+$conf['mail']['oncreate'] = array('requester');
 
-// Should we send mail when a comment is added to a ticket? Set to
-// 'all', 'requester', 'owner', or 'none'.
-$conf['mail']['oncomment'] = 'owner';
+// Should we send mail when a comment is added to a ticket? 
+// Set to any combination of 'all', 'requester', 'owner' or 'none'
+// eg $conf['mail']['oncomment'] = array('owner','requester');
+$conf['mail']['oncomment'] = array('owner');
 
-// Should we send mail on ticket assignment? Set to 'all', 'owner', or
-// 'none',
-$conf['mail']['onassign'] = 'owner';
+// Should we send mail on ticket assignment? 
+// Set to any combination of 'all', 'requester', 'owner' or 'none'
+// eg $conf['mail']['onassign'] = array('owner','requester');
+$conf['mail']['onassign'] = array('owner');
 
-// Should we send mail on ticket state change? Set to 'all', 'owner',
-// 'requester', or 'none'.
-$conf['mail']['onstate'] = 'none';
+// Should we send mail on ticket state change? 
+// Set to any combination of 'all', 'requester', 'owner' or 'none'
+// eg $conf['mail']['onstate'] = array('owner','requester');
+$conf['mail']['onstate'] = array();
 
-// Should we send mail on ticket priority change? Set to 'all',
-// 'owner', 'requester', or 'none'.
-$conf['mail']['onpriority'] = 'none';
+// Should we send mail on ticket priority change? 
+// Set to any combination of 'all', 'requester', 'owner' or 'none'
+// eg $conf['mail']['onpriority'] = array('owner','requester');
+$conf['mail']['onpriority'] = array();
 
 
 /**




thanks,

bo.





-- 
Whups mailing list
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.