[freeside-commits] freeside/httemplate/edit/cust_main billing.html, NONE, 1.1 contact.html, 1.1, 1.2

Ivan,,, ivan at wavetail.420.am
Wed Aug 24 06:22:28 PDT 2005


Update of /home/cvs/cvsroot/freeside/httemplate/edit/cust_main
In directory wavetail:/tmp/cvs-serv27204/httemplate/edit/cust_main

Modified Files:
	contact.html 
Added Files:
	billing.html 
Log Message:
customer edit: abstract out billing info to billing.html, re-do payment type selection with HTML::Widgets::SelectLayers, add Switch/Solo/Maestro support for start date & issue #.  customer view: re-order fields for consistency.  selfservice API: support paystart_month, paystart_year, payissue and payip in MyAccount::process_payment and ::edit_info and Signup::new_customer, FS::cust_main::realtime_bop: support paystart_month paystart_year payissue payip fields

--- NEW FILE: billing.html ---
<%

my( $cust_main ) = @_;
my $conf = new FS::Conf;
my $payby_default = $conf->config('payby-default');

if ( $payby_default eq 'HIDE' ) {

  $cust_main->payby('BILL') unless $cust_main->payby;

%>

  <INPUT TYPE="hidden" NAME="select" VALUE="<%= $cust_main->payby %>">

  </FORM>

  <FORM NAME="<%= $cust_main->payby %>" STYLE="margin-top: 0; margin-bottom: 0"> <% # XXX key %>

  <% foreach my $field (qw( payinfo payname paycvv paystart_month paystart_year payissue payip )) { %>

    <INPUT TYPE="hidden" NAME="<%= $field %>" VALUE="<%= $cust_main->getfield($field) %>">

  <% } %>

  <%
  #false laziness w/elements/select-month_year.html & view/cust_main/billing.html
  my( $mon, $year );
  my $date = $cust_main->paydate || '12-2037';
  if ( $date  =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
    ( $mon, $year ) = ( $2, $1 );
  } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
    ( $mon, $year ) = ( $1, $3 );
  } else {
    die "unrecognized expiration date format: $date";
  }
  %>

  <INPUT TYPE="hidden" NAME="exp_month" VALUE="<%= $mon %>">
  <INPUT TYPE="hidden" NAME="exp_year"  VALUE="<%= $year %>">

  </FORM>

  <FORM NAME="billing_bottomform" STYLE="margin-top: 0; margin-bottom: 0">

  <INPUT TYPE="hidden" NAME="tax" VALUE="<%= $cust_main->tax %>">

  <INPUT TYPE="hidden" NAME="invoicing_list" VALUE="<%= join(', ', $cust_main->invoicing_list) %>">

  </FORM>

<% } else {

  my @invoicing_list = $cust_main->invoicing_list;

  my $r = qq!<font color="#ff0000">*</font>&nbsp;!;

%>

  <BR>Billing information
  <%= &ntable("#cccccc") %>

    <TR>
      <TD ALIGN="right" WIDTH="200"><%=$r%>Billing type</TD>

  <SCRIPT>

    var mywindow = -1;
    function myopen(filename,windowname,properties) {
      myclose();
      mywindow = window.open(filename,windowname,properties);
    }
    function myclose() {
      if ( mywindow != -1 )
        mywindow.close();
      mywindow = -1;
    }

    var achwindow = -1;
    function achopen(filename,windowname,properties) {
      achclose();
      achwindow = window.open(filename,windowname,properties);
    }
    function achclose() {
      if ( achwindow != -1 )
        achwindow.close();
      achwindow = -1;
    }

    function card_changed(what) {
      if (
             what.form.payinfo.value.substring(0, 4) == '4093' 
          || what.form.payinfo.value.substring(0, 4) == '4911' 
          || what.form.payinfo.value.substring(0, 4) == '4936' 
          || what.form.payinfo.value.substring(0, 6) == '564132' 
          || what.form.payinfo.value.substring(0, 2) == '63' 
          || what.form.payinfo.value.substring(0, 2) == '67' 
         )
      {
        what.form.paystart_month.disabled = false;
        what.form.paystart_year.disabled = false;
        what.form.payissue.disabled = false;
        what.form.paystart_month.style.backgroundColor = '#ffffff';
        what.form.paystart_year.style.backgroundColor = '#ffffff';
        what.form.payissue.style.backgroundColor = '#ffffff';
        document.getElementById('paystart_label').style.color = '#000000';
        document.getElementById('payissue_label').style.color = '#000000';
      } else {
        what.form.paystart_month.disabled = true;
        what.form.paystart_year.disabled = true;
        what.form.payissue.disabled = true;
        what.form.paystart_month.style.backgroundColor = '#dddddd';
        what.form.paystart_year.style.backgroundColor = '#dddddd';
        what.form.payissue.style.backgroundColor = '#dddddd';
        document.getElementById('paystart_label').style.color = '#999999';
        document.getElementById('payissue_label').style.color = '#999999';
      }
      return true;
    }

  </SCRIPT>

  <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws.js"></SCRIPT>
  <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_iframe.js"></SCRIPT>
  <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_draggable.js"></SCRIPT>
  <SCRIPT TYPE="text/javascript">
  function OLiframeContent(src, width, height, name) {
    return ('<iframe src="'+src+'" width="'+width+'" height="'+height+'"'
     +(name?' name="'+name+'" id="'+name+'"':'')+' scrolling="auto">'
     +'<div>[iframe not supported]</div></iframe>');
  }
  </SCRIPT>

  <%

  my($payby, $payinfo, $payname)=(
    $cust_main->payby,
    $cust_main->payinfo,
    $cust_main->payname,
  );
  my( $account, $aba ) = split('@', $payinfo);

  my $disabled = 'DISABLED style="background-color: #dddddd"';
  my $text_disabled = 'style="color: #999999"';
  if ( $payby =~ /^(CARD|DCRD)$/ && cardtype($payinfo) =~ /^(Switch|Solo)$/ ) {
    $disabled = 'style="background-color: #ffffff"';
    $text_disabled = 'style="color: #000000";'
  }

  my %payby = (

    'CARD' =>

      '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.

        qq!<TR><TD ALIGN="right" WIDTH="200">${r}Card number </TD>!.
          qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payinfo" VALUE="!. ( $payby =~ /^(CARD|DCRD)$/ ? $payinfo : '' ). qq!" MAXLENGTH=19 onChange="card_changed(this)" onKeyUp="card_changed(this)"></TD></TR>!.

        qq!<TR><TD ALIGN="right" WIDTH="200">${r}Expiration </TD>!.
          '<TD WIDTH="408">'.

          include('/elements/select-month_year.html',
                    'prefix' => 'exp',
                    'selected_date' =>
                      ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->paydate : '' ),
                 ).

          '</TD></TR>'.

        qq!<TR><TD ALIGN="right" WIDTH="200">CVV2&nbsp;!.

          qq!(<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/cvv2.html', 472, 308, 'cvv2_popup' ), CAPTION, 'CVV2 Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;">help</A>)!.
          qq!</TD>!.
          '<TD WIDTH="408"><INPUT TYPE="text" NAME="paycvv" VALUE="'. ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->paycvv : '' ). '" SIZE=4 MAXLENGTH=4>'.


        qq!<TR><TD ALIGN="right" WIDTH="200"><SPAN ID="paystart_label" $text_disabled>Start date </SPAN></TD>!.
          '<TD WIDTH="408">'.

          include('/elements/select-month_year.html',
                    'prefix' => 'paystart',
                    'disabled' => $disabled,
                    'empty_option' => 1,
                    'start_year' => 2000,
                    'end_year'   => (localtime())[5] + 1900,
                    'selected_date' => (
                      ( $payby =~ /^(CARD|DCRD)$/
                        && cardtype($payinfo) =~ /^(Switch|Solo)$/ )
                          ? $cust_main->paystart_month. '-'.
                            $cust_main->paystart_year 
                          : ''
                    )
                 ).

        qq!<SPAN ID="payissue_label" $text_disabled> or Issue number </SPAN>!.
          '<INPUT TYPE="text" NAME="payissue" VALUE="'. ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->payissue : '' ). qq!" SIZE=3 MAXLENGTH=2 $disabled></TD></TR>!.

        qq!<TR><TD ALIGN="right" WIDTH="200">${r}Exact name on card </TD>!.
          qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payname" VALUE="!. ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->payname : '' ). qq!"></TD></TR>!.

        qq!<TR><TD COLSPAN=2 WIDTH="608"><INPUT TYPE="checkbox" NAME="payauto" !. ( $payby eq 'DCRD' ? '' : 'CHECKED' ). '> Charge future payments to this card automatically</TD></TR>'.

      '</TABLE>',

    'CHEK' => 

      '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.

        qq!<TR><TD ALIGN="right" WIDTH="200">${r}Account number </TD>!.
          qq!<TD WIDTH="408"><INPUT TYPE="text" SIZE=10 NAME="payinfo1" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $account : '' ). '"></TD></TR>'.

        qq!<TR><TD ALIGN="right" WIDTH="200">${r}ABA/Routing number </TD>!.
          qq!<TD WIDTH="408"><INPUT TYPE="text" SIZE=10 MAXLENGTH=9 NAME="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;">help</A>)!.
          qq!</TD></TR>!.

        qq!<INPUT TYPE="hidden" NAME="exp_month" VALUE="12">!.
        qq!<INPUT TYPE="hidden" NAME="exp_year" VALUE="2037">!.

        qq!<TR><TD ALIGN="right" WIDTH="200">${r}Bank name </TD>!.
          qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payname" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $cust_main->payname : '' ). qq!"></TD></TR>!.

        qq!<TR><TD COLSPAN=2 WIDTH="608"><INPUT TYPE="checkbox" NAME="payauto" !. ( $payby eq 'DCHK' ? '' : 'CHECKED' ). '> Charge future payments to this electronic check automatically</TD></TR>'.

        '<TR><TD>&nbsp;</TD></TR>'.
        '<TR><TD>&nbsp;</TD></TR>'.
        '<TR><TD>&nbsp;</TD></TR>'.

      '</TABLE>',

    'LECB' =>  

      '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.

        qq!<TR><TD ALIGN="right" WIDTH="200">${r}Phone number </TD>!.
          qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payinfo" VALUE="!. ( $payby eq 'LECB' ? $cust_main->payinfo : '' ). qq!" MAXLENGTH=15 SIZE=16></TD></TR>!.

        qq!<INPUT TYPE="hidden" NAME="exp_month" VALUE="12">!.
        qq!<INPUT TYPE="hidden" NAME="exp_year" VALUE="2037">!.
        qq!<INPUT TYPE="hidden" NAME="payname" VALUE="">!.

        '<TR><TD>&nbsp;</TD></TR>'.
        '<TR><TD>&nbsp;</TD></TR>'.
        '<TR><TD>&nbsp;</TD></TR>'.
        '<TR><TD>&nbsp;</TD></TR>'.
        '<TR><TD>&nbsp;</TD></TR>'.
        '<TR><TD>&nbsp;</TD></TR>'.

      '</TABLE>',

    'BILL' =>  

      '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.

        qq!<TR><TD ALIGN="right" WIDTH="200">P.O. </TD>!.
          qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payinfo" VALUE="!. ( $payby eq 'BILL' ? $cust_main->payinfo : '' ). qq!"></TD></TR>!.

        qq!<INPUT TYPE="hidden" NAME="exp_month" VALUE="12">!.
        qq!<INPUT TYPE="hidden" NAME="exp_year" VALUE="2037">!.

        qq!<TR><TD ALIGN="right" WIDTH="200">Attention </TD>!.
          qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payname" VALUE="!. ( $payby eq 'BILL' ? $cust_main->payname : '' ). qq!"></TD></TR>!.

        '<TR><TD>&nbsp;</TD></TR>'.
        '<TR><TD>&nbsp;</TD></TR>'.
        '<TR><TD>&nbsp;</TD></TR>'.
        '<TR><TD>&nbsp;</TD></TR>'.
        '<TR><TD>&nbsp;</TD></TR>'.

      '</TABLE>',

    'COMP' =>   

      '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.

        qq!<TR><TD ALIGN="right" WIDTH="200">${r}Approved by </TD>!.
          qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="payinfo" VALUE=""></TD></TR>!.

        qq!<TR><TD ALIGN="right" WIDTH="200">${r}Expiration </TD>!.
          '<TD WIDTH="408">'.

          include('/elements/select-month_year.html',
                    'prefix' => 'exp',
                    'selected_date' =>
                      ( $payby eq 'COMP' ? $cust_main->paydate : '' ),
                 ).

          '</TD></TR>'.

        '<TR><TD>&nbsp;</TD></TR>'.
        '<TR><TD>&nbsp;</TD></TR>'.
        '<TR><TD>&nbsp;</TD></TR>'.
        '<TR><TD>&nbsp;</TD></TR>'.
        '<TR><TD>&nbsp;</TD></TR>'.

      '</TABLE>',

  );

  tie my %options, 'Tie::IxHash',
    'CARD' => 'Credit card',
    'CHEK' => 'Electronic check',
    'LECB' => 'Phone bill billing',
    'BILL' => 'Billing',
    'COMP' => 'Complimentary',
  ;
  my %payby2option = (
    ( map { $_ => $_ } keys %options ),
    'DCRD' => 'CARD',
    'DCHK' => 'CHEK',
  );

  my $widget = new HTML::Widgets::SelectLayers(
    'options'        => \%options,
    #'form_name'      => 'dummy',
    #'form_action'    => 'nothingyet',
    #chops bottom of page in IE# 'under_position' => 'absolute',
    'html_between'   => '</TD></TR></TABLE>',
    'selected_layer' => $payby2option{$payby} || 'CARD',
    'layer_callback' => sub { my $layer = shift; $payby{$layer}; },
  );

  %>

  <TD WIDTH="408"><%= $widget->html %>

  <FORM NAME="billing_bottomform" STYLE="margin-top: 0; margin-bottom: 0">

  <%= &ntable("#cccccc") %>

    <TR><TD>&nbsp;</TD></TR>

    <TR>
      <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="tax" VALUE="Y" <%= $cust_main->tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt</TD>
    </TR>

    <TR>
      <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoicing_list_POST" VALUE="POST" <%=

        ( ( ! @invoicing_list && ! $conf->exists('disablepostalinvoicedefault') )
          || grep { $_ eq 'POST' } @invoicing_list                     )

          ? 'CHECKED'
          : ''

        %>> Postal mail invoice

      </TD>
    </TR>

    <TR>
      <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoicing_list_FAX" VALUE="FAX" <%=

        ( grep { $_ eq 'FAX' } @invoicing_list )
          ? 'CHECKED'
          : ''

        %>> Fax invoice

      </TD>
    </TR>

    <TR>
      <TD ALIGN="right" WIDTH="200">Email invoice </TD>
      <TD WIDTH="408"><INPUT TYPE="text" NAME="invoicing_list" VALUE="<%= join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) %>"></TD>
    </TR>

  </TABLE>

  </FORM>

  <%= $r %> required fields

<% } %>


Index: contact.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/cust_main/contact.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- contact.html	27 Dec 2004 09:23:23 -0000	1.1
+++ contact.html	24 Aug 2005 13:22:26 -0000	1.2
@@ -30,7 +30,7 @@
 
 %>
 
-<%= &itable("#cccccc") %>
+<%= &ntable("#cccccc") %>
 
 <TR>
   <TH ALIGN="right"><%=$r%>Contact&nbsp;name<BR>(last,&nbsp;first)</TH>
@@ -42,7 +42,7 @@
 <% if ( $conf->exists('show_ss') && !$pre ) { %>
   <TD ALIGN="right">SS#</TD>
   <TD><INPUT TYPE="text" NAME="ss" VALUE="<%= $cust_main->ss %>" SIZE=11></TD>
-<% } else { %>
+<% } elsif ( !$pre ) { %>
   <TD><INPUT TYPE="hidden" NAME="ss" VALUE="<%= $cust_main->ss %>"></TD>
 <% } %>
 



More information about the freeside-commits mailing list