You are here

function uc_coupon_workflow_rules_action_info in Ubercart Discount Coupons 7.3

Same name and namespace in other branches
  1. 7.2 uc_coupon_workflow/uc_coupon_workflow.rules.inc \uc_coupon_workflow_rules_action_info()

Implements hook_rules_action_info().

File

uc_coupon_workflow/uc_coupon_workflow.rules.inc, line 87
Rules integration for uc_coupon_workflow

Code

function uc_coupon_workflow_rules_action_info() {
  $actions = array();

  // Assign a coupon to a user.
  $actions['uc_coupon_workflow_assign'] = array(
    'label' => t('Authorize a user to use a coupon.'),
    'group' => t('Coupon'),
    'provides' => array(
      'coupon' => array(
        'type' => 'uc_coupon',
        'label' => t('Coupon'),
      ),
    ),
    'parameter' => array(
      'account' => array(
        'type' => 'user',
        'label' => t('Account'),
        'description' => t('Select the user account you wish to authorize.'),
      ),
      'cid' => array(
        'type' => 'integer',
        'label' => t('Coupon'),
        'description' => t('Select the base coupon to be assigned.
            The new user will be added to the list of authorized users for the selected coupon.'),
        'options list' => 'uc_coupon_workflow_cid_options',
        'restriction' => 'input',
      ),
    ),
  );

  // Send an e-mail regarding a coupon.
  $actions['uc_coupon_workflow_email'] = array(
    'label' => t('Send an email regarding a coupon.'),
    'group' => t('Coupon'),
    'parameter' => array(
      'coupon' => array(
        'type' => 'uc_coupon',
        'label' => t('Coupon'),
      ),
      'from' => array(
        'type' => 'text',
        'label' => t('Sender'),
        'restriction' => 'input',
      ),
      'addresses' => array(
        'type' => 'text',
        'label' => t('Recipients'),
        'description' => t('Enter the email addresses to receive the notifications, one per line.'),
        'restriction' => 'input',
      ),
      'subject' => array(
        'type' => 'text',
        'label' => t('Subject'),
        'description' => t('Enter the subject line for the notifications.'),
        'restriction' => 'input',
      ),
      'message' => array(
        'type' => 'text',
        'label' => t('Message'),
        'description' => t('Enter the message body for the notifications.'),
        'restriction' => 'input',
      ),
      'format' => array(
        'type' => 'text',
        'label' => t('Message format'),
        'options list' => 'uc_coupon_workflow_message_formats',
      ),
    ),
  );

  // Apply an automatic coupon.
  $actions['uc_coupon_workflow_apply'] = array(
    'label' => t('Apply a coupon to the current order.'),
    'group' => t('Coupon'),
    'provides' => array(
      'coupon' => array(
        'type' => 'uc_coupon',
        'label' => t('Coupon'),
      ),
    ),
    'parameter' => array(
      'cid' => array(
        'type' => 'integer',
        'label' => t('Coupon'),
        'description' => t('Select the coupon to apply.  The coupon will only be
            applied if and when all of its restrictions are satisfied.'),
        'options list' => 'uc_coupon_workflow_apply_options',
        'restriction' => 'input',
      ),
      'mode' => array(
        'type' => 'text',
        'label' => t('Mode'),
        'description' => t('Choose the way this coupon should be applied.'),
        'options list' => 'uc_coupon_workflow_apply_modes',
        'default value' => 'retain',
        'restriction' => 'input',
      ),
    ),
  );
  return $actions;
}