summaryrefslogtreecommitdiff
path: root/httemplate/edit/process
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/edit/process')
-rwxr-xr-xhttemplate/edit/process/agent.cgi10
-rw-r--r--httemplate/edit/process/currency_exchange.html36
-rwxr-xr-xhttemplate/edit/process/part_pkg.cgi13
3 files changed, 58 insertions, 1 deletions
diff --git a/httemplate/edit/process/agent.cgi b/httemplate/edit/process/agent.cgi
index 034c4cc50..554992958 100755
--- a/httemplate/edit/process/agent.cgi
+++ b/httemplate/edit/process/agent.cgi
@@ -5,6 +5,12 @@
'process_m2m' => { 'link_table' => 'access_groupagent',
'target_table' => 'access_group',
},
+ 'process_m2name' => {
+ 'link_table' => 'agent_currency',
+ 'name_col' => 'currency',
+ 'names_list' => [ $conf->config('currencies') ],
+ 'param_style' => 'link_table.value checkboxes',
+ },
'edit_ext' => 'cgi',
'noerror_callback' => $process_agent_pkg_class,
)
@@ -14,7 +20,9 @@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
-if ( FS::Conf->new->exists('disable_acl_changes') ) {
+my $conf = new FS::Conf;
+
+if ( $conf->exists('disable_acl_changes') ) {
errorpage('ACL changes disabled in public demo.');
die "shouldn't be reached";
}
diff --git a/httemplate/edit/process/currency_exchange.html b/httemplate/edit/process/currency_exchange.html
new file mode 100644
index 000000000..1f6852299
--- /dev/null
+++ b/httemplate/edit/process/currency_exchange.html
@@ -0,0 +1,36 @@
+%if ( $error ) {
+% errorpage($error); #also not super ideal
+%} else { #or this
+<% include('/elements/header.html', 'Exchange rates updated') %>
+<% include('/elements/footer.html') %>
+%}
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $conf = new FS::Conf;
+
+my $to_currency = $conf->config('currency') || 'USD';
+
+my @currencies = sort { $a cmp $b } $conf->config('currencies');
+
+#in the best of all possible worlds, i would be a single database transaction
+# but here it isn't terribly important other than offending my sense of elegance
+my $error = '';
+foreach my $currency (@currencies) {
+
+ my %hash = ( 'from_currency' => $currency,
+ 'to_currency' => $to_currency,
+ );
+
+ my $currency_exchange = qsearchs('currency_exchange', \%hash)
+ || new FS::currency_exchange \%hash;
+
+ $currency_exchange->rate( $cgi->param("$currency-$to_currency") );
+
+ my $method = $currency_exchange->currencyratenum ? 'replace' : 'insert';
+ $error = $currency_exchange->$method() and last;
+}
+
+</%init>
diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi
index 932e33b1d..3b6562f13 100755
--- a/httemplate/edit/process/part_pkg.cgi
+++ b/httemplate/edit/process/part_pkg.cgi
@@ -115,6 +115,19 @@ my $args_callback = sub {
push @args, 'options' => \%options;
###
+ #part_pkg_currency
+ ###
+
+ my %part_pkg_currency = (
+ map { $_ => scalar($cgi->param($_)) }
+ #grep /._[A-Z]{3}$/, #support other options
+ grep /^(setup|recur)_fee_[A-Z]{3}$/,
+ $cgi->param
+ );
+
+ push @args, 'part_pkg_currency' => \%part_pkg_currency;
+
+ ###
#pkg_svc
###