X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Felements%2Fpart_svc_column.html;h=1944e5f6f80859a941f375330bfa891e38a07904;hb=d65927fb45aa1c47d7f593db0142d14799b0fabf;hp=6dcb602fefdcc5db430014db5b38874dceac4a5a;hpb=1af8ff7f48f7259fc99f090c301c84b9680fdb4d;p=freeside.git diff --git a/httemplate/edit/elements/part_svc_column.html b/httemplate/edit/elements/part_svc_column.html index 6dcb602fe..1944e5f6f 100644 --- a/httemplate/edit/elements/part_svc_column.html +++ b/httemplate/edit/elements/part_svc_column.html @@ -63,35 +63,20 @@ my %communigate_fields = ( ); </%once> <INPUT TYPE="hidden" NAME="svcdb" VALUE="<% $svcdb %>"> -<BR><BR> -<& /elements/table.html &> - <TR><TH COLSPAN=<% $columns %>>Exports</TH></TR> - <TR> -% # exports -% foreach my $part_export (@part_export) { - <TD> - <INPUT TYPE="checkbox" \ - NAME="exportnum<% $part_export->exportnum %>" \ - VALUE=1 \ - <% $has_export_svc{$part_export->exportnum} ? 'CHECKED' : '' %>> - <% $part_export->label_html %> - </TD> -% $count++; -% if ( $count % $columns == 0 ) { - </TR> - <TR> -% } -% } - </TR> -</TABLE><BR><BR> -For the selected table, you can give fields default or fixed (unchangeable) -values, or select an inventory class to manually or automatically fill in -that field. +<BR> +%# include export selection +<& export_svc.html, + part_svc => $part_svc, + svcdb => $svcdb +&> + +<FONT CLASS="fsinnerbox-title">Fields</FONT> <& /elements/table-grid.html, cellpadding => 4 &> <TR> <TH BGCOLOR="#cccccc">Field</TH> <TH BGCOLOR="#cccccc">Label</TH> <TH BGCOLOR="#cccccc" COLSPAN=2>Modifier</TH> + <TH BGCOLOR="#cccccc"><% $manual_require ? 'Required?' : '' %></TH> </TR> % $part_svc->set('svcpart' => $opt{'clone'}) if $opt{'clone'}; # for now % my $i = 0; @@ -155,7 +140,8 @@ that field. 'value_col' => $def->{'select_key'}, 'order_by' => dbdef->table($def->{'select_table'})->primary_key, 'multiple' => $def->{'multiple'}, - 'disable_empty' => 1, + 'disable_empty' => $def->{'select_allow_empty'} ? undef : 1, + 'empty_label' => $def->{'select_allow_empty'} ? ' ' : undef, 'curr_value' => $value, # these can be switched between multiple and singular, # so put the complete curr_value in an attribute @@ -222,11 +208,21 @@ that field. 'empty_label' => "Select $mode class", 'multiple' => $multiple, &> +% } + </TD> + <TD> +% if ($manual_require && +% (!$def->{'type'} || !(grep {$_ eq $def->{'type'}} ('checkbox','disabled'))) +% ) { + <INPUT ID="<% $name.'_required' %>" TYPE="checkbox" NAME="<% $svcdb %>__<% $field %>_required" VALUE="Y" + <% ($part_svc_column->required || $def->{'required'}) ? 'CHECKED' : '' %> + <% $def->{'required'} ? 'DISABLED' : '' %> + > % } </TD> </TR> <TR CLASS="row<%$i%>"> - <TD COLSPAN=2 CLASS="def_info"> + <TD COLSPAN=3 CLASS="def_info"> % if ( $def->{def_info} ) { (<% $def->{def_info} %>) </TD> @@ -242,7 +238,7 @@ that field. <TD COLSPAN=3 ALIGN="right"> <% emt('Require "Provision" access right to edit password') %> </TD> - <TD> + <TD COLSPAN=2> <INPUT TYPE="checkbox" NAME="restrict_edit_password" VALUE="Y" \ <% $part_svc->restrict_edit_password ? 'CHECKED' : '' %>> </TD> @@ -258,7 +254,7 @@ that field. <TD COLSPAN=3 ALIGN="right"> <% emt('This service has an attached router') %> </TD> - <TD> + <TD COLSPAN=2> <INPUT TYPE="checkbox" NAME="has_router" VALUE="Y" \ <% $part_svc->has_router ? 'CHECKED' : '' %>> </TD> @@ -277,7 +273,7 @@ that field. &> % $svcpart = '' if $opt{clone}; <BR> -<INPUT NAME="submit" +<INPUT NAME="submitButton" TYPE="button" VALUE="<% emt($svcpart ? 'Apply changes' : 'Add service') %>" onclick="fixup_submit('<%$svcdb%>')" @@ -285,27 +281,18 @@ that field. <%init> my $svcdb = shift; my %opt = @_; -my $columns = 3; my $count = 0; my $communigate = 0; my $conf = FS::Conf->new; my $part_svc = $opt{'part_svc'} || FS::part_svc->new; -my @part_export; -my $export_info = FS::part_export::export_info($svcdb); -foreach (keys %{ $export_info }) { - push @part_export, qsearch('part_export', { exporttype => $_ }); +# see if there are communigate exports configured +if ( exists $communigate_fields{$svcdb} ) { + $communigate = FS::part_export->count("exporttype like 'communigate%'"); } -$communigate = scalar(grep {$_->exporttype =~ /^communigate/} @part_export); my $svcpart = $opt{'clone'} || $part_svc->svcpart; -my %has_export_svc; -if ( $svcpart ) { - foreach (qsearch('export_svc', { svcpart => $svcpart })) { - $has_export_svc{$_->exportnum} = 1; - } -} my @fields; if ( defined( dbdef->table($svcdb) ) ) { # when is it ever not defined? @@ -324,4 +311,5 @@ if ( $svcdb eq 'svc_acct' } my @defs = map { FS::part_svc->svc_table_fields($svcdb)->{$_} } @fields; +my $manual_require = FS::part_svc->svc_table_info($svcdb)->{'manual_require'}; </%init>