You are here

function uc_coupon_purchase_rules_action_info in Ubercart Discount Coupons 7.3

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

Implements hook_rules_action_info().

File

uc_coupon_purchase/uc_coupon_purchase.rules.inc, line 37
Rules integration for uc_coupon_purchase

Code

function uc_coupon_purchase_rules_action_info() {
  $actions = array();
  $actions['uc_coupon_purchase_email'] = array(
    'label' => t('Send an order email regarding coupon purchase.'),
    'group' => t('Coupon'),
    'parameter' => array(
      'order' => array(
        'type' => 'uc_order',
        'label' => t('Order'),
        'optional' => TRUE,
      ),
      'coupon' => array(
        'type' => 'uc_coupon',
        'label' => t('Coupon'),
      ),
      'from' => array(
        'type' => 'text',
        'label' => t('Sender'),
      ),
      'addresses' => array(
        'type' => 'text',
        'label' => t('Recipients'),
        'description' => t('Enter the email addresses to receive the notifications, one on each line. You may use order tokens for dynamic email addresses.'),
      ),
      'subject' => array(
        'type' => 'text',
        'label' => t('Subject'),
      ),
      'message' => array(
        'type' => 'text',
        'label' => t('Message'),
      ),
      'format' => array(
        'type' => 'text',
        'label' => t('Message format'),
        'options list' => 'uc_coupon_purchase_message_formats',
      ),
    ),
  );
  $actions['uc_coupon_purchase_assign_action'] = array(
    'label' => t('Assign a coupon to a user'),
    'group' => t('Coupon'),
    'provides' => array(
      'coupon' => array(
        'type' => 'uc_coupon',
        'label' => t('Coupon'),
      ),
    ),
    'named parameter' => TRUE,
    'parameter' => array(
      'cid' => array(
        'type' => 'integer',
        'label' => t('Coupon'),
        'description' => t('Select the base coupon to be assigned.'),
        'options list' => 'uc_coupon_purchase_cid_options',
      ),
      'account' => array(
        'type' => 'user',
        'label' => t('Account'),
        'description' => t('Select the user to whom the coupon should be assigned.'),
      ),
      'restrict' => array(
        'type' => 'boolean',
        'label' => t('Restrict coupon usage to assigned users.'),
        'description' => t('When selected, the assignee will be added to the list of authorized
          users for this coupon.  Only authorized users will be able to use the coupon.'),
        'default value' => FALSE,
        'allow null' => TRUE,
        'restriction' => 'input',
        'optional' => TRUE,
      ),
      'sole' => array(
        'type' => 'boolean',
        'label' => t('Make this user the sole owner.'),
        'description' => t('When selected, all other assigned users will be removed.
          If you check "%r" above, this user will become the only person authorized to use this coupon.', array(
          '%r' => t('Restrict coupon usage to assigned users.'),
        )),
        'default value' => FALSE,
        'allow null' => TRUE,
        'restriction' => 'input',
        'optional' => TRUE,
      ),
      'clone' => array(
        'type' => 'boolean',
        'label' => t('Clone the base coupon before assigning.'),
        'description' => t('When checked, the base coupon will be cloned and a copy assigned to the specified user,
          exactly as if the user had purchased the coupon.  If unchecked, the base coupon will be assigned to the
          user directly'),
        'default value' => FALSE,
        'allow null' => TRUE,
        'restriction' => 'input',
        'optional' => TRUE,
      ),
      'quantity' => array(
        'type' => 'integer',
        'label' => t('Quantity.'),
        'description' => t('The number of copies of the base coupon to assign. If the base coupon is a bulk coupon,
          this will be multiplied by the base coupon\'s bulk number. Only meaningful if you select "%c" above.', array(
          '%c' => t('Clone the base coupon before assigning.'),
        )),
        'default value' => 1,
        'allow null' => TRUE,
        'restriction' => 'input',
        'optional' => TRUE,
      ),
    ),
  );
  return $actions;
}