You are here

function invoice_set_pay_status in Invoice 6

Same name and namespace in other branches
  1. 7 invoice.module \invoice_set_pay_status()

Set the status of an invoice to paid

1 string reference to 'invoice_set_pay_status'
invoice_menu in ./invoice.module
Implementation of hook_menu()

File

./invoice.module, line 811
Invoice module

Code

function invoice_set_pay_status($invoice_number, $status) {
  if ($status != 'paid' && $status != 'unpaid') {
    drupal_set_message(t('Invalid invoice pay status'), 'error');
  }
  else {
    db_query("UPDATE {invoice_invoices} SET pay_status='%s' WHERE iid=%d", $status, $invoice_number);
    drupal_set_message('Succesfully changed pay status of invoice ' . check_plain($invoice_number) . ' to "paid"');
  }
  $exp = explode('?', $_GET['q']);
  $query_string = '?q=&' . $exp[1];
  $a_query_vars = _invoice_getvars_string_to_array($query_string);
  drupal_goto('invoices', $a_query_vars);
}