invoice template and config localization, #12367
[freeside.git] / httemplate / edit / cust_main / billing.html
index d6995af..294104b 100644 (file)
     }
 
     function payauto_changed(payauto_field){
-        var f = (payauto_field.name == 'CARD_payauto') ? 'card_billday' : 'chek_billday';
-        f = document.getElementById(f);
-        if ( f == null) return;
-        if(payauto_field.checked) f.style.display = '';
-        else f.style.display = 'none';
+        var span = (payauto_field.name == 'CARD_payauto') ? 'card_billday' : 'chek_billday';
+        var select = document.getElementById('select_'+span);
+        span = document.getElementById(span);
+        if (span == null || select == null) return;
+        if(payauto_field.checked) {
+            span.style.color = '#000000';
+            select.disabled = false;
+        }
+        else {
+            span.style.color = '#999999';
+            select.disabled = true;
+            select.selectedIndex = 0;
+        }
     }
     
   </SCRIPT>
 %  my $payby = $cust_main->payby;
 %  my $paytype = $cust_main->paytype;
 %  my( $account, $aba ) = split('@', $payinfo);
+%  my $branch = '';
+%  ($branch,$aba) = split('\.',$aba) if $conf->exists('cust_main-require-bank-branch');
 %
 %  my $disabled = 'DISABLED style="background-color: #dddddd"';
 %  my $text_disabled = 'style="color: #999999"';
 %   $ret;
 %  }
 %
-%  my $card_billday_style = $payby eq 'CARD' ? '' : 'style="display: none"';
-%  my $chek_billday_style = $payby eq 'CHEK' ? '' : 'style="display: none"';
+%  my $card_billday_style = $payby eq 'CARD' ? '' : 'style="color: #999999"';
+%  my $chek_billday_style = $payby eq 'CHEK' ? '' : 'style="color: #999999"';
+%  my $card_billday_select_disabled = $payby eq 'CARD' ? '' : 'DISABLED';
+%  my $chek_billday_select_disabled = $payby eq 'CHEK' ? '' : 'DISABLED';
 %
 %  my %payby = (
 %
 %
 %        qq!<TR><TD COLSPAN=2 WIDTH="608">!.
 %           qq!<INPUT TYPE="checkbox" onchange="payauto_changed(this);" ID="CARD_payauto" NAME="CARD_payauto" $CARD_payauto_checked> !.
-%           emt('Charge future payments to this [_1] automatically','credit card').
+%           emt('Charge future payments to this [_1] automatically','credit card').'</TD></TR>'.
 %
 %      ( $conf->exists('cust_main-select-billday') ?
-%        qq!<BR><DIV id="card_billday" $card_billday_style>
-%                    Charge on this day of each month <SELECT NAME="billday">!
-%                . billday_options($cust_main->billday) . qq!</SELECT> </DIV>!
+%        qq!<TR><TD ALIGN="RIGHT" id="card_billday" $card_billday_style>
+%                    Charge on this day of each month</TD><TD> &nbsp; 
+%                   <SELECT id="select_card_billday" $card_billday_select_disabled NAME="billday">!
+%                . billday_options($cust_main->billday) . qq!</SELECT> </TD></TR>!
 %        : ''
 %      ).
 %
-%      '</TD></TR></TABLE>',
+%      '</TABLE>',
 %
 %    'CHEK' => 
 %
 %            join('', map { qq!<OPTION VALUE="$_" !.($paytype eq $_ ? 'SELECTED' : '').">$_</OPTION>" } @FS::cust_main::paytypes).
 %          qq!</SELECT></TD></TR>!.
 %
-%        qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('ABA/Routing number').qq! </TD>!.
-%          qq!<TD COLSPAN="3" WIDTH="408"><INPUT TYPE="text" SIZE=10 MAXLENGTH=9 NAME="CHEK_payinfo2" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $aba : '' ). qq!" SIZE=10 MAXLENGTH=9> !.
-%          qq!(<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/ach.html', 380, 240, 'ach_popup' ), CAPTION, 'ACH Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;">!.emt('help').qq!</A>)!.
-%          qq!</TD></TR>!.
+%        ( $conf->exists('echeck-no_routing')
+%          ? '<INPUT TYPE="hidden" NAME="CHEK_payinfo2" VALUE="'.
+%              ( $payby =~ /^(CHEK|DCHK)$/ ? $aba : '' ). '">'
+%          :
+%            qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('ABA/Routing number').qq! </TD>!.
+%              qq!<TD COLSPAN="3" WIDTH="408"><INPUT TYPE="text" SIZE=10 MAXLENGTH=9 NAME="CHEK_payinfo2" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $aba : '' ). qq!" SIZE=10 MAXLENGTH=9> !.
+%              qq!(<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/ach.html', 380, 240, 'ach_popup' ), CAPTION, 'ACH Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;">!.emt('help').qq!</A>)!.
+%              qq!</TD></TR>!
+%        ).
 %
 %        qq!<INPUT TYPE="hidden" NAME="CHEK_exp_month" VALUE="12">!.
 %        qq!<INPUT TYPE="hidden" NAME="CHEK_exp_year" VALUE="2037">!.
 %
+%        ( $conf->exists('cust_main-require-bank-branch') ? 
+%               qq!<TR><TD ALIGN="right">$r !.emt('Branch number').qq!</TD><TD COLSPAN="3">
+%                   <INPUT TYPE="text" name="CHEK_payinfo3" VALUE=$branch></TD></TR>! : '' ).
+%   
 %        qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Bank name').qq! </TD>!.
 %          qq!<TD COLSPAN="3" WIDTH="408"><INPUT TYPE="text" NAME="CHEK_payname" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $cust_main->payname : '' ). qq!"></TD></TR>!.
 %      ( $conf->exists('show_bankstate') ?
 %
 %        qq!<TR><TD COLSPAN=4 WIDTH="608">!.
 %           qq!<INPUT TYPE="checkbox" onchange="payauto_changed(this);" ID="CHEK_payauto" NAME="CHEK_payauto" $CHEK_payauto_checked> !.
-%           emt('Charge future payments to this [_1] automatically','electronic check').
+%           emt('Charge future payments to this [_1] automatically','electronic check').'</TD></TR>'.
 %
 %      ( $conf->exists('cust_main-select-billday') ?
-%        qq!<DIV id="chek_billday" $chek_billday_style>
-%                    Charge on this day of each month <SELECT NAME="billday">!
-%                . billday_options($cust_main->billday) . qq!</SELECT> </DIV>!
+%        qq!<TR><TD ALIGN="RIGHT" id="chek_billday" $chek_billday_style>
+%                    Charge on this day of each month</TD><TD> &nbsp;
+%                   <SELECT id="select_chek_billday" $chek_billday_select_disabled NAME="billday">!
+%                . billday_options($cust_main->billday) . qq!</SELECT> </TD></TR>!
 %        : ''
 %      ).
 %
-%      '</TD></TR></TABLE>',
+%      '</TABLE>',
 %
 %    'LECB' =>  
 %
@@ -491,7 +514,7 @@ function toggle(obj) {
 
 % if ( $conf->exists('voip-cust_cdr_squelch') ) { 
       <TR>
-       <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="squelch_cdr" VALUE="Y" <% $cust_main->squelch_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Omit CDRs from printed invoices') |h %></TD>
+       <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="squelch_cdr" VALUE="Y" <% $cust_main->squelch_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt($conf->exists('voip-cdr_email') ? 'Omit CDRs from printed invoices' : 'Omit CDRs from invoices') |h %></TD>
       </TR>
 % } else { 
       <INPUT TYPE="hidden" NAME="squelch_cdr" VALUE="<% $cust_main->squelch_cdr %>">
@@ -532,11 +555,33 @@ function toggle(obj) {
       <INPUT TYPE="hidden" NAME="cdr_termination_percentage" VALUE="<% $cust_main->cdr_termination_percentage %>">
 % }
 
+%my @available_locales = $conf->config('available-locales');
+%if ( scalar(@available_locales) ) {
+%   push @available_locales, '';
+%    my %locale_labels = map { 
+%        my %ll;
+%        my %info = FS::Locales->locale_info($_);
+%        $ll{$_} = $info{name} . " (" . $info{country} . ")";
+%        %ll;
+%    } FS::Locales->locales;
+  <& /elements/tr-select.html, 
+        'label'         => emt('Invoicing locale'),
+        'field'         => 'locale',
+        'options'       => \@available_locales,
+        'labels'        => \%locale_labels,
+        'curr_value'    => $cust_main->locale,
+  &>
+% }
+
   </TABLE>
 
   <% $r %> <% mt('required fields') |h %> 
 % } 
 
+<script type="text/javascript">
+    init_payauto_changed();
+</script>
+
 <%once>
 
 my $paystate_label = FS::Msgcat::_gettext('paystate');