mv_charge_user db spec_list { notify_subject " " } { notify_body " " }What it does:
Takes a spec in the form of [list user_id admin_id charge_type charge_key amount charge_comment] and adds a row to the users_charges tableDefined in: /web/philip/tcl/ad-member-value.tcl
Source code:
# we double the apostrophes right here to avoid any trouble with SQL
set QQspec_list [DoubleApos $spec_list]
set user_id [lindex $QQspec_list 0]
set admin_id [lindex $QQspec_list 1]
set charge_type [lindex $QQspec_list 2]
set charge_key [lindex $QQspec_list 3]
set amount [lindex $QQspec_list 4]
set unquoted_charge_comment [lindex $spec_list 5]
ns_db dml $db "insert into users_charges
(user_id, admin_id, charge_type, charge_key, amount, charge_comment, entry_date)
values
($user_id, $admin_id, '$charge_type', '$charge_key', $amount, [ns_dbquotevalue $unquoted_charge_comment text], sysdate)"
if ![empty_string_p $notify_subject] {
# we're going to email this user and tell him that we charged him
# but we don't want an error in notification to cause this to fail
catch { mv_notify_user_of_new_charge $db $spec_list $notify_subject $notify_body }
}