You are here

function uc_order_ca_predicate in Ubercart 6.2

Implements hook_ca_predicate().

File

uc_order/uc_order.ca.inc, line 78
This file contains the Conditional Actions hooks and functions necessary to make the order related entity, conditions, events, and actions work.

Code

function uc_order_ca_predicate() {
  $predicates = array();
  $predicates['uc_order_update_email_customer'] = array(
    '#title' => t('E-mail an order update notification'),
    '#description' => t('Notify the customer when the order status is changed.'),
    '#class' => 'notification',
    '#status' => 1,
    '#trigger' => 'uc_order_status_email_update',
    '#conditions' => array(
      '#operator' => 'AND',
      '#conditions' => array(
        array(
          '#name' => 'uc_order_status_condition',
          '#title' => t('If the order status is not still In Checkout.'),
          '#argument_map' => array(
            'order' => 'order',
          ),
          '#settings' => array(
            'negate' => TRUE,
            'order_status' => 'in_checkout',
          ),
        ),
      ),
    ),
    '#actions' => array(
      array(
        '#name' => 'uc_order_email',
        '#title' => t('Send an e-mail to the customer'),
        '#argument_map' => array(
          'order' => 'order',
        ),
        '#settings' => array(
          'from' => uc_store_email_from(),
          'addresses' => '[order-email-raw]',
          'subject' => t('Order #[order-id] Update'),
          'message' => uc_get_message('order_update_email'),
          'format' => 1,
        ),
      ),
    ),
  );
  return $predicates;
}