prospect add/edit: order fields more like customer add/edit, hide company in resident...
[freeside.git] / httemplate / config / config-delete.cgi
1 <%init>
2
3 my $curuser = $FS::CurrentUser::CurrentUser;
4 die "access denied\n" unless $curuser->access_right('Configuration');
5
6 my $fsconf = new FS::Conf;
7 if ( $fsconf->exists('disable_settings_changes') ) {
8   my @changers = split(/\s*,\s*/, $fsconf->config('disable_settings_changes'));
9   my %changers = map { $_=>1 } @changers;
10   unless ( $changers{$curuser->username} ) {
11     errorpage("Disabled in web demo");
12     die "shouldn't be reached";
13   }
14 }
15
16 $cgi->param('confnum') =~ /^(\d+)$/ or die "illegal or missing confnum";
17 my $confnum = $1;
18
19 my $conf = qsearchs('conf', {'confnum' => $confnum});
20 die "Configuration not found!" unless $conf;
21 $conf->delete;
22
23 my $redirect = popurl(2);
24 if ( $cgi->param('redirect') eq 'config_view_showagent' ) {
25   $redirect .= 'config/config-view.cgi?showagent=1#'. $conf->name;
26 } elsif ( $cgi->param('redirect') eq 'config_view' ) {
27   $redirect .= 'config/config-view.cgi';
28 } else {
29   $redirect .= 'browse/agent.cgi';
30 }
31
32 </%init>
33 <% $cgi->redirect($redirect) %>