fix county selector
[freeside.git] / httemplate / edit / cust_main.cgi
index dfcd040..896472d 100755 (executable)
@@ -17,6 +17,7 @@
 %my $error = '';
 %my($custnum, $username, $password, $popnum, $cust_main, $saved_pkgpart);
 %my(@invoicing_list);
+%my $payinfo;
 %my $same = '';
 %if ( $cgi->param('error') ) {
 %  $error = $cgi->param('error');
@@ -36,6 +37,7 @@
 %  @invoicing_list = split( /\s*,\s*/, $cgi->param('invoicing_list') );
 %  $same = $cgi->param('same');
 %  $cust_main->setfield('paid' => $cgi->param('paid')) if $cgi->param('paid');
+%  $payinfo = $cust_main->payinfo; # don't mask an entered value on errors
 %} elsif ( $cgi->keywords ) { #editing
 %  my( $query ) = $cgi->keywords;
 %  $query =~ /^(\d+)$/;
@@ -52,6 +54,7 @@
 %  $password = '';
 %  $popnum = 0;
 %  @invoicing_list = $cust_main->invoicing_list;
+%  $payinfo = $cust_main->paymask;
 %} else {
 %  $custnum='';
 %  $cust_main = new FS::cust_main ( {} );
@@ -62,6 +65,9 @@
 %  $password = '';
 %  $popnum = 0;
 %  @invoicing_list = ();
+%  push @invoicing_list, 'POST'
+%    unless $conf->exists('disablepostalinvoicedefault');
+%  $payinfo = '';
 %}
 %$cgi->delete_all();
 %
 % } else { 
 
 
-   <% include('/elements/tr-select-part_referral.html') %>
+   <% include('/elements/tr-select-part_referral.html', $refnum ) %>
 % } 
 
 
 
 </TABLE>
 
+<!-- birthdate -->
+
+% if ( $conf->exists('cust_main-enable_birthdate') ) {
+
+  <BR>
+  <% ntable("#cccccc", 2) %>
+  <% include ('/elements/tr-input-date-field.html',
+              'birthdate',
+              $cust_main->birthdate,
+              'Date of Birth',
+              $conf->config('date_format') || "%m/%d/%Y",
+              1)
+  %>
+
+  </TABLE>
+
+% }
+
 <!-- contact info -->
 
 <BR><BR>
@@ -180,17 +204,19 @@ function bill_changed(what) {
     what.form.ship_<%$_%>.value = what.form.<%$_%>.value;
 % } 
 
-
     what.form.ship_country.selectedIndex = what.form.country.selectedIndex;
+
+    function fix_ship_county() {
+      what.form.ship_county.selectedIndex = what.form.county.selectedIndex;
+    }
+
     function fix_ship_state() {
       what.form.ship_state.selectedIndex = what.form.state.selectedIndex;
+      ship_state_changed(what.form.ship_state, fix_ship_county );
     }
+
     ship_country_changed(what.form.ship_country, fix_ship_state );
 
-    function fix_ship_county() {
-      what.form.ship_county.selectedIndex = what.form.county.selectedIndex;
-    }
-    ship_state_changed(what.form.ship_state, fix_ship_county );
   }
 }
 function samechanged(what) {
@@ -218,7 +244,7 @@ function samechanged(what) {
 %  my $disabledselect = '';
 %  unless ( $cust_main->ship_last && $same ne 'Y' ) {
 %    $checked = 'CHECKED';
-%    $disabled = 'DISABLED style="background-color: #dddddd"';
+%    $disabled = 'DISABLED STYLE="background-color: #dddddd"';
 %    foreach (
 %      qw( last first company address1 address2 city county state zip country
 %          daytime night fax )
@@ -239,6 +265,7 @@ Service address
 <!-- billing info -->
 
 <% include( 'cust_main/billing.html', $cust_main,
+               'payinfo'        => $payinfo,
                'invoicing_list' => \@invoicing_list,
            )
 %>
@@ -247,6 +274,8 @@ Service address
 function bottomfixup(what) {
 
   var topvars = new Array(
+    'birthdate',
+
     'custnum', 'agentnum', 'refnum', 'referral_custnum',
 
     'last', 'first', 'ss', 'company',
@@ -329,6 +358,8 @@ function copyelement(from, to) {
 
 <FORM ACTION="<% popurl(1) %>process/cust_main.cgi" METHOD=POST NAME="bottomform" onSubmit="document.bottomform.submit.disabled=true; bottomfixup(this.form);" STYLE="margin-top: 0; margin-bottom: 0">
 % foreach my $hidden (
+%     'birthdate',
+%
 %     'custnum', 'agentnum', 'refnum', 'referral_custnum',
 %     'last', 'first', 'ss', 'company',
 %     'address1', 'address2', 'city',
@@ -359,17 +390,20 @@ function copyelement(from, to) {
 
   <INPUT TYPE="hidden" NAME="<% $hidden %>" VALUE="">
 % } 
-
+%
+% my $ro_comments = $conf->exists('cust_main-use_comments')?'':'readonly';
+% if (!$ro_comments || $cust_main->comments) {
 
 <BR>Comments
 <% &ntable("#cccccc") %>
   <TR>
     <TD>
-      <TEXTAREA COLS=80 ROWS=5 WRAP="HARD" NAME="comments"><% $cust_main->comments %></TEXTAREA>
+      <TEXTAREA COLS=80 ROWS=5 WRAP="HARD" NAME="comments" <%$ro_comments%>><% $cust_main->comments %></TEXTAREA>
     </TD>
   </TR>
 </TABLE>
 %
+% }
 %
 %unless ( $custnum ) {
 %  # pry the wrong place for this logic.  also pretty expensive