summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2009-05-03 01:11:50 +0000
committerivan <ivan>2009-05-03 01:11:50 +0000
commit53cadf47dea115cf804d07beb58c7de67429873f (patch)
tree7aa14078fd18128b956980afa757d64e3385ce36
parentae8f98d14eb70d671e808d41167ae6afb2ee7053 (diff)
add ability to remove suffix-ed config items, RT#5218
-rw-r--r--FS/FS/Conf.pm12
-rw-r--r--httemplate/config/config-delete.cgi4
-rw-r--r--httemplate/config/config-view.cgi12
3 files changed, 20 insertions, 8 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index cf4c43908..d3bd81762 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -92,6 +92,7 @@ sub _usecompat {
$compat->$method(@_);
}
+# needs a non _ name, called externally by config-view now (and elsewhere?)
sub _config {
my($self,$name,$agentnum)=@_;
my $hashref = { 'name' => $name };
@@ -451,11 +452,12 @@ sub _orbase_items {
die "don't know about $base items" unless $proto->key eq $base;
map { new FS::ConfItem {
- 'key' => $_,
- 'section' => $proto->section,
- 'description' => 'Alternate ' . $proto->description . ' See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Invoice_templates">billing documentation</a> for details.',
- 'type' => $proto->type,
- };
+ 'key' => $_,
+ 'base_key' => $proto->key,
+ 'section' => $proto->section,
+ 'description' => 'Alternate ' . $proto->description . ' See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Invoice_templates">billing documentation</a> for details.',
+ 'type' => $proto->type,
+ };
} &$listmaker($base);
} @base_items,
);
diff --git a/httemplate/config/config-delete.cgi b/httemplate/config/config-delete.cgi
index ffeae7877..a05cb1e14 100644
--- a/httemplate/config/config-delete.cgi
+++ b/httemplate/config/config-delete.cgi
@@ -10,8 +10,10 @@ die "Configuration not found!" unless $conf;
$conf->delete;
my $redirect = popurl(2);
-if ( $cgi->param('redirect') eq 'config_view' ) {
+if ( $cgi->param('redirect') eq 'config_view_showagent' ) {
$redirect .= 'config/config-view.cgi?showagent=1#'. $conf->name;
+} elsif ( $cgi->param('redirect') eq 'config_view' ) {
+ $redirect .= 'config/config-view.cgi';
} else {
$redirect .= 'browse/agent.cgi';
}
diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi
index aca37f2ad..9b5b13251 100644
--- a/httemplate/config/config-view.cgi
+++ b/httemplate/config/config-view.cgi
@@ -97,7 +97,16 @@ Click on a configuration value to change it.
)
%>: <% $i->description %>
% if ( $agent && $cgi->param('showagent') ) {
- (<A HREF="javascript:areyousure('delete this agent override', 'config-delete.cgi?confnum=<% _config_agentonly($conf, $i->key, $agent->agentnum)->confnum %>;redirect=config_view')">delete agent override</A>)
+% my $confnum =
+% _config_agentonly($conf, $i->key, $agent->agentnum)->confnum;
+ (<A HREF="javascript:areyousure('delete this agent override', 'config-delete.cgi?confnum=<% $confnum %>;redirect=config_view_showagent')">delete agent override</A>)
+% } elsif ( $i->base_key ) {
+% my $confnum =
+% $agent
+% ? _config_agentonly($conf, $i->key, $agent->agentnum)->confnum
+% : $conf->_config( $i->key )->confnum;
+% my $showagent = $cgi->param('showagent') ? '_showagent' : '';
+ (<A HREF="javascript:areyousure('delete this configuration item', 'config-delete.cgi?confnum=<% $confnum %>;redirect=config_view<%$showagent%>')">delete configuration item</A>)
% }
</td>
@@ -308,7 +317,6 @@ if ($cgi->param('agentnum') =~ /^(\d+)$/) {
my $conf = new FS::Conf;
my @config_items = grep { $page_agent ? $_->per_agent : 1 }
- grep { $_->key != ~/^invoice_(html|latex|template)/ }
$conf->config_items;
my @sections = qw(required billing username password UI session shell BIND );