function invoice_set_pay_status in Invoice 7
Same name and namespace in other branches
- 6 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 - Implements hook_menu()
File
- ./
invoice.module, line 1053 - 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_update('invoice_invoices')
->fields(array(
'pay_status' => $status,
))
->condition('iid', $invoice_number)
->execute();
if ($status == 'unpaid') {
drupal_set_message(t('Succesfully changed pay status of invoice @invoice_number to "unpaid"', array(
'@invoice_number' => $invoice_number,
)));
}
else {
drupal_set_message(t('Succesfully changed pay status of invoice @invoice_number to "paid"', array(
'@invoice_number' => $invoice_number,
)));
}
}
$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);
}