function pay_admin_settings_submit in Pay 7
Same name and namespace in other branches
- 6 includes/pay.admin.inc \pay_admin_settings_submit()
Submit handler for settings form.
1 string reference to 'pay_admin_settings_submit'
- pay_admin_settings in includes/
pay.admin.inc - Overall settings form for global payment options.
File
- includes/
pay.admin.inc, line 55 - Administration form settings and related functions.
Code
function pay_admin_settings_submit($form, &$form_state) {
// No variable has been set yet, so this is the first time setting this value.
// Set this default value on all pay_forms and pay_transactions.
$currency = $form_state['values']['pay_currency'];
if (!($count = db_query("SELECT count(1)\n FROM {pay_transaction} WHERE currency IS NOT NULL AND currency NOT IN ('', :currency)", array(
':currency' => $currency,
))
->fetchField())) {
db_update('pay_form')
->fields(array(
'currency' => $currency,
))
->execute();
db_update('pay_transaction')
->fields(array(
'currency' => $currency,
))
->execute();
}
}