[freeside-commits] freeside/httemplate/elements select-discount_term.html, NONE, 1.1 tr-select-discount_term.html, NONE, 1.1 customer-table.html, 1.3, 1.4

Jeff Finucane,420,, jeff at wavetail.420.am
Wed Sep 22 12:16:20 PDT 2010


Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail.420.am:/tmp/cvs-serv19099/httemplate/elements

Modified Files:
	customer-table.html 
Added Files:
	select-discount_term.html tr-select-discount_term.html 
Log Message:
prepayment discounts rt#5318

Index: customer-table.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/customer-table.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -d -r1.3 -r1.4
--- customer-table.html	18 May 2008 03:04:03 -0000	1.3
+++ customer-table.html	22 Sep 2010 19:16:18 -0000	1.4
@@ -22,6 +22,7 @@
              ###
 
              'name_singular' => 'customer', #label
+             'custnum_update_callback' => 'name_of_js_callback' #passed a rownum
 
              #listrefs
              'types'         => ['immutable', ''], # immutable or ''/text
@@ -98,6 +99,9 @@
       if ( name.length > 0 ) {
         customer.value = name;
         customer.setAttribute('magic', 'nosearch');
+% if ( $opt{custnum_update_callback} ) {
+        <% $opt{custnum_update_callback} %>(searchrow, '<% $opt{prefix} %>')
+% }
       } else {
         customer.value = 'Not found';
         customer.style.color = '#ff0000';
@@ -162,6 +166,9 @@
         customer_obj.style.display = '';
         customer_select.style.display = 'none';
 
+% if ( $opt{custnum_update_callback} ) {
+        <% $opt{custnum_update_callback} %>(searchrow, '<% $opt{prefix} %>')
+% }
 
       } else {
 
@@ -223,6 +230,10 @@
       this.style.display = 'none';
       customer_obj.style.display = '';
 
+% if ( $opt{custnum_update_callback} ) {
+      <% $opt{custnum_update_callback} %>(searchrow, '<% $opt{prefix} %>')
+% }
+
     }
 
   }
@@ -314,7 +325,7 @@
         >
 %     } elsif ($types->[$col] eq 'immutable') {
         <% $font %><% $value %><% $font ? '</FONT>' : '' %>
-        <INPUT TYPE="hidden" NAME="<% $name %>" VALUE="<% $value %>" >
+        <INPUT TYPE="hidden" ID="<% $name %>" NAME="<% $name %>" VALUE="<% $value %>" >
 %     } else {
         Cannot represent unknown type: <% $types->[$col] %>
 %     }

--- NEW FILE: tr-select-discount_term.html ---
% if ( scalar(@discount_term) ) {
  <TR>
    <TD ALIGN="right">Prepayment for</TD>
    <TD COLSPAN=2>
      <% include('select-discount_term.html',
                   'discount_term' => \@discount_term,
                   'cgi'           => $opt{'cgi'},
                )
      %>
    </TD>
  </TR>

% }

<%init>
my %opt = @_;

my $custnum = $opt{'custnum'};

my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } )
  or die "unknown custnum $custnum\n";

my @discount_term = $cust_main->discount_terms;

</%init>

--- NEW FILE: select-discount_term.html ---
% if ( scalar(@discount_term) ) {
    <SELECT NAME="discount_term">
      <OPTION VALUE="">1 month
%   foreach my $discount_term (@discount_term) {
%     my $sel = ( $cgi->param('discount_term') == $discount_term ) ? 'SELECTED' : '';
      <OPTION <% $sel %> VALUE="<% $discount_term %>"><% $discount_term. " months" %>
%   }
    </SELECT>
% }
<%init>

my %opt = @_;

my $cgi = $opt{'cgi'};

my @discount_term;
if ( $opt{discount_term} ) {

  @discount_term = @{ $opt{discount_term} };

} else {

  my $custnum = $opt{'custnum'};

  my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } )
    or die "unknown custnum $custnum\n";

  @discount_term = $cust_main->discount_terms;

}

</%init>



More information about the freeside-commits mailing list