diff options
author | Christopher Burger <burgerc@freeside.biz> | 2019-02-19 14:42:25 -0500 |
---|---|---|
committer | Christopher Burger <burgerc@freeside.biz> | 2019-02-19 14:42:25 -0500 |
commit | a7a22257d456394125eed32f8261c75a7f393ec2 (patch) | |
tree | 444e0a4e3594952c1ddb9212e65dd061b5f4866f /httemplate | |
parent | 772656864b377bbd2ef2febd40891ef1206b5be0 (diff) |
RT# 82092 - custom fields now save and fixed so name label is displayed insted of actual field name
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/browse/router.cgi | 43 | ||||
-rw-r--r-- | httemplate/edit/cust_main/basics.html | 2 | ||||
-rw-r--r-- | httemplate/edit/elements/part_svc_column.html | 2 | ||||
-rw-r--r-- | httemplate/edit/elements/svc_Common.html | 3 | ||||
-rwxr-xr-x | httemplate/edit/process/cust_main.cgi | 5 | ||||
-rw-r--r-- | httemplate/edit/process/part_virtual_field.html | 3 | ||||
-rw-r--r-- | httemplate/view/cust_main/misc.html | 2 |
7 files changed, 38 insertions, 22 deletions
diff --git a/httemplate/browse/router.cgi b/httemplate/browse/router.cgi index 85512f8df..c7713f313 100644 --- a/httemplate/browse/router.cgi +++ b/httemplate/browse/router.cgi @@ -7,24 +7,9 @@ 'extra_sql' => $extra_sql, }, 'count_query' => "SELECT count(*) from router $count_sql", - 'header' => [ 'Router name', - 'Address block(s)', - 'IP addressing', - 'Action', - ], - 'fields' => [ 'routername', - sub { join( '<BR>', map { $_->NetAddr } - shift->addr_block - ); - }, - sub { shift->manual_addr ? 'Manual' : 'Automatic' }, - sub { 'Delete' }, - ], - 'links' => [ [ "${p2}edit/router.cgi?", 'routernum' ], - '', - '', - [ "${p}misc/delete-router.html?", 'routernum' ], - ], + 'header' => [ @header_fields ], + 'fields' => [ @fields ], + 'links' => [ @links ], 'agent_virt' => 1, 'agent_null_right'=> "Broadband global configuration", 'agent_pos' => 1, @@ -32,6 +17,8 @@ %> <%init> +use CGI qw(escapeHTML); + die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Broadband configuration') || $FS::CurrentUser::CurrentUser->access_right('Broadband global configuration'); @@ -52,6 +39,26 @@ if ($cgi->param('hidecustomerrouters') eq '1') { $cgi->delete('hidecustomerrouters'); } +my @header_fields = ('Router name', 'Address block(s)', 'IP addressing'); +my @fields = ( 'routername', + sub { join( '<BR>', map { $_->NetAddr } shift->addr_block); }, + sub { shift->manual_addr ? 'Manual' : 'Automatic' }, + ); +my @links = ( [ "${p2}edit/router.cgi?", 'routernum' ], + '', + '', + ); + +foreach (FS::router->virtual_fields_hash) { + push @header_fields, escapeHTML($_->{'label'}); + push @fields, escapeHTML($_->{'name'}); + push @links, ''; +} + +push @header_fields, 'Action'; +push @fields, sub { 'Delete' }; +push @links, [ "${p}misc/delete-router.html?", 'routernum' ]; + my $count_sql = $extra_sql. ( $extra_sql =~ /WHERE/ ? ' AND' : 'WHERE' ). $FS::CurrentUser::CurrentUser->agentnums_sql( 'null_right' => 'Broadband global configuration', diff --git a/httemplate/edit/cust_main/basics.html b/httemplate/edit/cust_main/basics.html index 97313aada..b45523f4f 100644 --- a/httemplate/edit/cust_main/basics.html +++ b/httemplate/edit/cust_main/basics.html @@ -117,7 +117,7 @@ </SCRIPT> % foreach my $field ($cust_main->virtual_fields) { - <% $cust_main->pvf($field)->widget('HTML', 'edit',$cust_main->getfield($field)) %> + <% $cust_main->pvf($field)->widget('HTML', 'edit',$cust_main->getfield($field), 'TH') %> % } %# tags diff --git a/httemplate/edit/elements/part_svc_column.html b/httemplate/edit/elements/part_svc_column.html index bdbce7c79..075f15e2c 100644 --- a/httemplate/edit/elements/part_svc_column.html +++ b/httemplate/edit/elements/part_svc_column.html @@ -97,7 +97,7 @@ my %communigate_fields = ( <TD ROWSPAN=2 CLASS="grid"> <INPUT NAME="<% $svcdb %>__<% $field %>_label" STYLE="text-align: right" - VALUE="<% $part_svc_column->columnlabel || $def->{'label'} |h %>"> + VALUE="<% $part_svc_column->columnlabel || escapeHTML($def->{'label'}) |h %>"> </TD> <TD ROWSPAN=1 CLASS="grid"> diff --git a/httemplate/edit/elements/svc_Common.html b/httemplate/edit/elements/svc_Common.html index e1c309080..e5dc55979 100644 --- a/httemplate/edit/elements/svc_Common.html +++ b/httemplate/edit/elements/svc_Common.html @@ -227,7 +227,8 @@ $html .= $svc_x->pvf($field)->widget( 'HTML', 'edit', - $svc_x->getfield($field) + $svc_x->getfield($field), + 'TH' ); } } diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index e1a5bc6e2..baacd5e7e 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -97,6 +97,11 @@ my $new = new FS::cust_main ( { (map { ( "ship_$_", '' ) } (FS::cust_main->location_fields)) } ); +# add any virtual fields to the new cust_main record +foreach ($new->virtual_fields) { + $new->setfield($_, scalar($cgi->param($_))); +} + warn Dumper( $new ) if $DEBUG > 1; if ( $duplicate_of ) { diff --git a/httemplate/edit/process/part_virtual_field.html b/httemplate/edit/process/part_virtual_field.html index e734d9616..6a8008db7 100644 --- a/httemplate/edit/process/part_virtual_field.html +++ b/httemplate/edit/process/part_virtual_field.html @@ -42,6 +42,9 @@ my $act = 'add'; +## make cgi->param("name") lowercase +$cgi->param('name' => lc $cgi->param('name')); + die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index cb465f57e..d2deae245 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -172,7 +172,7 @@ % } % foreach (sort { $a cmp $b } $cust_main->virtual_fields) { - <% $cust_main->pvf($_)->widget('HTML', 'view', $cust_main->getfield($_)) %> + <% $cust_main->pvf($_)->widget('HTML', 'view', $cust_main->getfield($_), 'TH') %> % } </TABLE> |