summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/browse/part_svc.cgi13
-rw-r--r--httemplate/edit/elements/part_svc_column.html15
-rwxr-xr-xhttemplate/edit/part_svc.cgi20
-rw-r--r--httemplate/misc/payment.cgi4
4 files changed, 46 insertions, 6 deletions
diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi
index 0d3685355..ec5f321dd 100755
--- a/httemplate/browse/part_svc.cgi
+++ b/httemplate/browse/part_svc.cgi
@@ -61,6 +61,8 @@ function part_export_areyousure(href) {
<TH COLSPAN=2 CLASS="grid" BGCOLOR="#cccccc">Modifier</TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc" STYLE="font-size: smaller;">Required</TH>
+
</TR>
% my $conf = FS::Conf->new;
% foreach my $part_svc ( @part_svc ) {
@@ -78,6 +80,9 @@ function part_export_areyousure(href) {
% $col->columnflag || ( $col->columnlabel !~ /^\S*$/
% && $col->columnlabel ne $def->{'label'}
% )
+% || ( $col->required
+% && !$def->{'required'}
+% )
% )
% }
% @dfields ;
@@ -150,7 +155,7 @@ function part_export_areyousure(href) {
</TD>
% unless ( @fields ) {
-% for ( 1..4 ) {
+% for ( 1..5 ) {
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>"</TD>
% }
% }
@@ -170,7 +175,6 @@ function part_export_areyousure(href) {
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $field %></TD>
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $label %></TD>
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $flag{$flag} %></TD>
-
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
% my $value = &$formatter($part_svc->part_svc_column($field)->columnvalue);
% if ( $flag =~ /^[MAH]$/ ) {
@@ -189,6 +193,11 @@ function part_export_areyousure(href) {
% }
</TD>
+ <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
+% if ($part_svc_column->required) {
+ Yes
+% }
+ </TD>
% $n1="</TR><TR>";
% } #foreach $field
% if ( $part_svc->restrict_edit_password ) {
diff --git a/httemplate/edit/elements/part_svc_column.html b/httemplate/edit/elements/part_svc_column.html
index 2bb4f5e41..a6ccaf867 100644
--- a/httemplate/edit/elements/part_svc_column.html
+++ b/httemplate/edit/elements/part_svc_column.html
@@ -77,6 +77,7 @@ that field.
<TH BGCOLOR="#cccccc">Field</TH>
<TH BGCOLOR="#cccccc">Label</TH>
<TH BGCOLOR="#cccccc" COLSPAN=2>Modifier</TH>
+ <TH BGCOLOR="#cccccc">Required?</TH>
</TR>
% $part_svc->set('svcpart' => $opt{'clone'}) if $opt{'clone'}; # for now
% my $i = 0;
@@ -210,9 +211,17 @@ that field.
&>
% }
</TD>
+ <TD>
+% if (!$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>
@@ -228,7 +237,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>
@@ -244,7 +253,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>
diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi
index 47b020c5a..7a47f1550 100755
--- a/httemplate/edit/part_svc.cgi
+++ b/httemplate/edit/part_svc.cgi
@@ -101,6 +101,15 @@ function flag_changed(obj) {
}
}
}
+ var required = document.getElementById(layer + '__' + field + '_required');
+ if (required && !required.disabledinit) {
+ if (newflag == "F") {
+ required.checked = false;
+ required.disabled = true;
+ } else {
+ required.disabled = false;
+ }
+ }
}
window.onload = function() {
@@ -111,6 +120,17 @@ window.onload = function() {
obj.setAttribute('should_be_multiple', true);
}
}
+ var inputs = document.getElementsByTagName('INPUT');
+ for(i = 0; i < inputs.length; i++) {
+ var obj = inputs[i];
+ if (obj.type == 'checkbox') {
+ if ( obj.name.match(/_required$/) ) {
+ if ( obj.disabled ) {
+ obj.disabledinit = 1;
+ }
+ }
+ }
+ }
for(i = 0; i < selects.length; i++) {
var obj = selects[i];
if ( obj.name.match(/_flag$/) ) {
diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi
index 90b03c7e8..b83ad7166 100644
--- a/httemplate/misc/payment.cgi
+++ b/httemplate/misc/payment.cgi
@@ -273,7 +273,9 @@ my @states = sort { $a cmp $b } keys %states;
my $amount = '';
if ( $balance > 0 ) {
- $amount = $balance;
+ $amount = $balance
+ unless $conf->exists('manual_process-single_invoice_amount')
+ && ($cust_main->open_cust_bill != 1);
}
my $payunique = "webui-payment-". time. "-$$-". rand() * 2**32;