--- coupon_abramo.module	Fri May 18 09:10:13 2007
+++ coupon.module	Wed Oct 24 13:57:54 2007
@@ -1,5 +1,5 @@
 <?php
-// $Id: coupon.module,v 1.6.2.2.2.8.2.12 2007/03/03 13:32:22 gordon Exp $
+//$Id: coupon.module,v 1.6.2.2.2.8.2.15 2007/10/16 03:30:30 sammys Exp $
 
 define('ECMAIL_TYPE_COUPON', 'coupon');
 define('MAILVAR_COUPON', 'ec_mail_coupon');
@@ -80,13 +80,13 @@ function coupon_menu($may_cache) {
       'title' => 'make coupon inactive',
       'callback' => 'coupon_inactivate',
       'callback arguments' => array(arg(3)),
-      'access' => user_access('administor store'),
+      'access' => user_access('administer store'),
       'type' => MENU_CALLBACK,
     );
     $items[] = array('path' => 'store/coupon/admin/autocomplete', 
       'title' => t('product autocomplete'),
       'callback' => 'coupon_autocomplete', 
-      'access' => user_access('administor store'),
+      'access' => user_access('administer store'),
       'type' => MENU_CALLBACK);
   }
   return $items;
@@ -96,7 +96,7 @@ function coupon_menu($may_cache) {
  * Implementation of hook_ec_settings()
  */
 function coupon_ec_settings() {
-  $form = ec_mail_selection_form_for_variable('coupon_settings_form', ECMAIL_TYPE_COUPON, t('Coupon e-mail'), MAILVAR_COUPON, t('This text will be emailed to customer after they buy a coupon.'));
+  $form = ec_mail_selection_form_for_variable(__FUNCTION__, ECMAIL_TYPE_COUPON, t('Coupon e-mail'), MAILVAR_COUPON, t('This text will be emailed to customer after they buy a coupon.'));
   return system_settings_form($form);
 }
 
@@ -499,7 +499,7 @@ function coupon_admin_list($created = nu
         array('data' => payment_format($coupon->coupon_discount), 'align' => 'right'),
         array('data' => $coupon->operator != '%' ? payment_format(($coupon->operand * ($coupon->operator == '+' ? 1 : -1)) - $coupon->coupon_discount) : '', 'align' => 'right'),
         array('data' => format_date($coupon->created, 'small')),
-        array('data' => user_access('administor store') ? l($coupon->created_txnid, "store/transaction/view/{$coupon->created_txnid}") : $coupon->created_txnid),
+        array('data' => user_access('administer store') ? l($coupon->created_txnid, "store/transaction/view/{$coupon->created_txnid}") : $coupon->created_txnid),
         array('data' => $coupon->active == 1 ? 'active '. l('(cancel)', "store/coupon/cancel/{$coupon->coupon}") : 'cancelled' . l('(delete)', "admin/store/coupon/delete/".$coupon->coupon)),
         array('data' => l($coupon->nid, 'node/'.$coupon->nid)),
       );
@@ -747,12 +747,12 @@ function _coupon_format($coupon) {
 function coupon_token_list($type = 'all') {
   if ($type == 'all' || $type == ECMAIL_TYPE_COUPON) {
     if ($type == ECMAIL_TYPE_COUPON) {
-      $tokens = token_list(STORE_TOKEN_TYPE);
+      $tokens = token_token_list(STORE_TOKEN_TYPE);
     } else {
       $tokens = array();
     }
-    $tokens[ECMAIL_TYPE_COUPON]['gift-cert-number']   = t('Gift certificate number.');
-    $tokens[ECMAIL_TYPE_COUPON]['gift-cert-discount'] = t('Gift certificate discount amount.');
+    $tokens[ECMAIL_TYPE_COUPON]['coupon-number']   = t('Gift certificate number.');
+    $tokens[ECMAIL_TYPE_COUPON]['coupon-discount'] = t('Gift certificate discount amount.');
   }
   
   return $tokens;
@@ -766,8 +766,8 @@ function coupon_token_values($type, $obj
   
   if ($type == ECMAIL_TYPE_COUPON) {
     $values = store_token_values(STORE_TOKEN_TYPE, $object);
-    $values['coupon-number']   = _coupon_format($txn->coupon['coupon']);
-    $values['coupon-discount'] = payment_format($txn->coupon['operand']);
+    $values['coupon-number']   = _coupon_format($object->coupon['coupon']);
+    $values['coupon-discount'] = payment_format($object->coupon['operand']);
   }
 
   return $values;
