partial #2023 - Notifiy an email and/or phone number by text when someone places an order with a particular name or phone number

This commit is contained in:
Daniel Camargo 2013-11-08 17:47:30 -02:00
parent f068a58c0d
commit 273e371974
2 changed files with 5 additions and 4 deletions

View File

@ -6,7 +6,7 @@ class Crunchbutton_Email_RulesNotify extends Crunchbutton_Email {
public function __construct( $params ) {
$params['to'] = $params['email'].', Crunchbutton Copy <_USERNAME_>';
$params['to'] = $params['email'];
$params['subject'] = $params['subject'];
$params['from'] = 'Tech Support <tech@_DOMAIN_>';
$params['reply'] = 'Tech Support <tech@_DOMAIN_>';

View File

@ -43,7 +43,7 @@ class Crunchbutton_Order_Rules extends Cana_Model {
);
$this->_rules[ 'monitor-name-phone' ] = array( 'method' => 'validation_monitorNamePhone',
'alert' => 'Monitor alert: The user %s P#%s just ordered some food. O#%s',
'alert' => 'Monitor alert: The user %s P#%s just ordered some food from %s. O#%s',
'settings' => array( 'active' => 'rule-monitor-name-phone-active',
'name' => 'rule-monitor-name-phone-name',
'phone' => 'rule-monitor-name-phone-phone',
@ -193,7 +193,7 @@ class Crunchbutton_Order_Rules extends Cana_Model {
$mail = new Crunchbutton_Email_RulesNotify([
'message' => $message,
'subject' => $message,
'to' => $email
'email' => $email
]);
$mail->send();
@ -304,8 +304,9 @@ class Crunchbutton_Order_Rules extends Cana_Model {
if( count( $matches ) > 0 ){
$message = $this->createAlert( $rule[ 'alert' ], array( $order->name, $order->phone, $order->restaurant()->name, $order->id_order ) );
// Send sms
$message = $this->createAlert( $rule[ 'alert' ], array( $order->name, $order->phone, $order->id_order ) );
$phones = $this->getSetting( $rule[ 'settings' ][ 'warning-phone' ] );
if( $phones && trim( $phones ) != '' ){
$phones = explode( ',', $phones );