You are here

function uc_coupon_purchase_print in Ubercart Discount Coupons 7.3

Same name and namespace in other branches
  1. 6 uc_coupon_purchase/uc_coupon_purchase.pages.inc \uc_coupon_purchase_print()
  2. 7.2 uc_coupon_purchase/uc_coupon_purchase.pages.inc \uc_coupon_purchase_print()

Print a purchased coupon.

1 string reference to 'uc_coupon_purchase_print'
uc_coupon_purchase_menu in uc_coupon_purchase/uc_coupon_purchase.module
Implements hook_menu().

File

uc_coupon_purchase/uc_coupon_purchase.pages.inc, line 83
Page callbacks for uc_coupon.

Code

function uc_coupon_purchase_print($account, $coupon, $op = 'view', $code = NULL) {
  drupal_set_title(t('Coupon #@cid', array(
    '@cid' => $coupon->cid,
  )), PASS_THROUGH);
  module_load_include('inc', 'uc_coupon', 'uc_coupon.admin');
  $url = 'user/' . $account->uid . '/coupons/' . $coupon->cid . '/print' . ($code ? "/{$code}" : '');
  $output = '<p>' . l($coupon->bulk && !$code ? t('Print coupons') : t('Print coupon'), $url) . '</p>';

  // Add the owner account object to the coupon.
  $coupon->owner = $account;

  // Does not return if op = 'print'
  $output .= uc_coupon_print($coupon, $code, $op);
  return $output;
}