summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
authorivan <ivan>2007-12-17 01:00:29 +0000
committerivan <ivan>2007-12-17 01:00:29 +0000
commit530b42f465b0ab31fbb4c2754d0e385b330f3b5f (patch)
tree665fcdb94a895c88d00db926197bf2ab4b98fb69 /httemplate/edit
parentb8e867851869e8dc53b117f91dd3de10ea56f66b (diff)
add cust_main-require_address2 config, reimplement address2-search config ("Unit #" search in searchbar), visual indication of require_invoicing_list_email, closes: RT#2926
Diffstat (limited to 'httemplate/edit')
-rwxr-xr-xhttemplate/edit/cust_main.cgi85
-rw-r--r--httemplate/edit/cust_main/billing.html4
-rw-r--r--httemplate/edit/cust_main/contact.html18
3 files changed, 72 insertions, 35 deletions
diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi
index 5ab605f5d..9b3d7b6b9 100755
--- a/httemplate/edit/cust_main.cgi
+++ b/httemplate/edit/cust_main.cgi
@@ -203,13 +203,31 @@
<!-- contact info -->
+% my $same_checked = '';
+% my $ship_disabled = '';
+% unless ( $cust_main->ship_last && $same ne 'Y' ) {
+% $same_checked = 'CHECKED';
+% $ship_disabled = 'DISABLED STYLE="background-color: #dddddd"';
+% foreach (
+% qw( last first company address1 address2 city county state zip country
+% daytime night fax )
+% ) {
+% $cust_main->set("ship_$_", $cust_main->get($_) );
+% }
+% }
+
<BR><BR>
Billing address
-<% include('cust_main/contact.html', $cust_main, '', 'bill_changed(this)', '', 'ss' => $ss, 'stateid' => $stateid ) %>
-
-<!-- service address -->
-% if ( defined $cust_main->dbdef_table->column('ship_last') ) {
-
+<% include('cust_main/contact.html',
+ 'cust_main' => $cust_main,
+ 'pre' => '',
+ 'onchange' => 'bill_changed(this)',
+ 'disabled' => '',
+ 'ss' => $ss,
+ 'stateid' => $stateid,
+ 'same_checked' => $same_checked, #for address2 "Unit #" labeling
+ )
+%>
<SCRIPT>
function bill_changed(what) {
@@ -237,44 +255,47 @@ function bill_changed(what) {
function samechanged(what) {
if ( what.checked ) {
bill_changed(what);
-% for (qw( last first company address1 address2 city county state zip country daytime night fax )) {
- what.form.ship_<%$_%>.disabled = true;
- what.form.ship_<%$_%>.style.backgroundColor = '#dddddd';
-% }
+% for (qw( last first company address1 address2 city county state zip country daytime night fax )) {
+ what.form.ship_<%$_%>.disabled = true;
+ what.form.ship_<%$_%>.style.backgroundColor = '#dddddd';
+% }
+
+% if ( $conf->exists('cust_main-require_address2') ) {
+ document.getElementById('address2_required').style.visibility = '';
+ document.getElementById('address2_label').style.visibility = '';
+ document.getElementById('ship_address2_required').style.visibility = 'hidden';
+ document.getElementById('ship_address2_label').style.visibility = 'hidden';
+% }
} else {
-% for (qw( last first company address1 address2 city county state zip country daytime night fax )) {
- what.form.ship_<%$_%>.disabled = false;
- what.form.ship_<%$_%>.style.backgroundColor = '#ffffff';
-% }
+% for (qw( last first company address1 address2 city county state zip country daytime night fax )) {
+ what.form.ship_<%$_%>.disabled = false;
+ what.form.ship_<%$_%>.style.backgroundColor = '#ffffff';
+% }
+
+% if ( $conf->exists('cust_main-require_address2') ) {
+ document.getElementById('address2_required').style.visibility = 'hidden';
+ document.getElementById('address2_label').style.visibility = 'hidden';
+ document.getElementById('ship_address2_required').style.visibility = '';
+ document.getElementById('ship_address2_label').style.visibility = '';
+% }
}
}
</SCRIPT>
-%
-% my $checked = '';
-% my $disabled = '';
-% my $disabledselect = '';
-% unless ( $cust_main->ship_last && $same ne 'Y' ) {
-% $checked = 'CHECKED';
-% $disabled = 'DISABLED STYLE="background-color: #dddddd"';
-% foreach (
-% qw( last first company address1 address2 city county state zip country
-% daytime night fax )
-% ) {
-% $cust_main->set("ship_$_", $cust_main->get($_) );
-% }
-% }
-%
-
<BR>
Service address
-(<INPUT TYPE="checkbox" NAME="same" VALUE="Y" onClick="samechanged(this)" <%$checked%>>same as billing address)
-<% include('cust_main/contact.html', $cust_main, 'ship_', '', $disabled ) %>
-% }
+(<INPUT TYPE="checkbox" NAME="same" VALUE="Y" onClick="samechanged(this)" <%$same_checked%>>same as billing address)
+<% include('cust_main/contact.html',
+ 'cust_main' => $cust_main,
+ 'pre' => 'ship_',
+ 'onchange' => '',
+ 'disabled' => $ship_disabled,
+ )
+%>
<!-- billing info -->
diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html
index 0b16f65b0..68d7437e5 100644
--- a/httemplate/edit/cust_main/billing.html
+++ b/httemplate/edit/cust_main/billing.html
@@ -426,7 +426,9 @@
% }
<TR>
- <TD ALIGN="right" WIDTH="200">Email invoice </TD>
+ <TD ALIGN="right" WIDTH="200">
+ <% $conf->exists('cust_main-require_invoicing_list_email') ? $r : '' %>Email address(es)
+ </TD>
<TD WIDTH="408"><INPUT TYPE="text" NAME="invoicing_list" VALUE="<% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) %>"></TD>
</TR>
% if ( $conf->exists('voip-cust_cdr_spools') ) {
diff --git a/httemplate/edit/cust_main/contact.html b/httemplate/edit/cust_main/contact.html
index ac0debd12..fdc518e54 100644
--- a/httemplate/edit/cust_main/contact.html
+++ b/httemplate/edit/cust_main/contact.html
@@ -32,8 +32,16 @@
</TD>
</TR>
+% my $address2_label_style =
+% ( $disabled
+% || ! $conf->exists('cust_main-require_address2')
+% || ( !$pre && !$opt{'same_checked'} )
+% )
+% ? 'visibility:hidden'
+% : '';
+
<TR>
- <TD ALIGN="right">&nbsp;</TD>
+ <TD ALIGN="right"><FONT ID="<% $pre %>address2_required" color="#ff0000" STYLE="<% $address2_label_style %>">*</FONT>&nbsp;<FONT ID="<% $pre %>address2_label" STYLE="<% $address2_label_style %>"><B>Unit&nbsp;#</B></FONT></TD>
<TD COLSPAN=7>
<INPUT TYPE="text" NAME="<%$pre%>address2" VALUE="<% $cust_main->get($pre.'address2') %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%>>
</TD>
@@ -106,7 +114,13 @@
<%init>
-my( $cust_main, $pre, $onchange, $disabled, %opt ) = @_;
+#my( $cust_main, $pre, $onchange, $disabled, %opt ) = @_;
+my %opt = @_;
+my $cust_main = $opt{'cust_main'};
+my $pre = $opt{'pre'};
+my $onchange = $opt{'onchange'};
+my $disabled = $opt{'disabled'};
+
my $conf = new FS::Conf;
foreach (qw(ss stateid)) {