You are here

function uc_coupon_delete_confirm_submit in Ubercart Discount Coupons 6

Same name and namespace in other branches
  1. 5 uc_coupon.module \uc_coupon_delete_confirm_submit()
  2. 7.3 uc_coupon.admin.inc \uc_coupon_delete_confirm_submit()
  3. 7.2 uc_coupon.admin.inc \uc_coupon_delete_confirm_submit()

File

./uc_coupon.admin.inc, line 1029

Code

function uc_coupon_delete_confirm_submit($form, &$form_state) {
  $coupon = uc_coupon_load($form['#uc_coupon_cid']);
  module_invoke_all('uc_coupon_delete', $coupon);
  db_query("DELETE FROM {uc_coupons} WHERE cid = %d", $form['#uc_coupon_cid']);
  db_query("DELETE FROM {uc_coupons_orders} WHERE cid = %d", $form['#uc_coupon_cid']);
  drupal_set_message(t('Coupon %name has been deleted.', array(
    '%name' => $coupon->name,
  )));
  $form_state['redirect'] = 'admin/store/coupons' . ($coupon->status ? '' : '/inactive');
}