diff options
| author | Mark Wells <mark@freeside.biz> | 2012-04-14 12:02:14 -0700 | 
|---|---|---|
| committer | Mark Wells <mark@freeside.biz> | 2012-04-14 12:02:14 -0700 | 
| commit | 5f2f706faad794d87d930c64db8eb641fe61990d (patch) | |
| tree | 90f08fdbed3305636a3ccb9475e847f43489ca5a /httemplate/misc | |
| parent | 7150fcff4de104614319b5c57104d55e250dc8c3 (diff) | |
fix various quick payment entry problems, #17356
Diffstat (limited to 'httemplate/misc')
| -rw-r--r-- | httemplate/misc/batch-cust_pay.html | 24 | ||||
| -rw-r--r-- | httemplate/misc/process/batch-cust_pay.cgi | 2 | ||||
| -rw-r--r-- | httemplate/misc/xmlhttp-cust_main-discount_terms.cgi | 19 | ||||
| -rw-r--r-- | httemplate/misc/xmlhttp-cust_main-search.cgi | 8 | 
4 files changed, 31 insertions, 22 deletions
| diff --git a/httemplate/misc/batch-cust_pay.html b/httemplate/misc/batch-cust_pay.html index 11fdeee61..2e798652d 100644 --- a/httemplate/misc/batch-cust_pay.html +++ b/httemplate/misc/batch-cust_pay.html @@ -62,10 +62,10 @@ function select_discount_term(row, prefix) {                name_singular => 'payment',                header  => \@header,                fields  => \@fields, -              types   => \@types, +              type    => \@types,                align   => \@align, -              sizes   => \@sizes, -              colors  => \@colors, +              size    => \@sizes, +              color   => \@colors,                param   => \%param,                footer  => \@footer,                footer_align => \@footer_align, @@ -96,18 +96,19 @@ die "access denied"  my $conf = new FS::Conf;  my $money_char = $conf->config('money_char') || '$'; -my @header  = ( '', 'Amount', 'Check #' ); -my @fields  = ( sub { "$money_char" }, 'paid', 'payinfo' ); -my @types   = ( 'immutable', '', '' ); -my @align   = ( 'c', 'r', 'r' ); -my @sizes   = ( 0, 8, 10 ); -my @colors  = ( '', '', '' ); +my @header  = ( 'Amount', 'Check #' ); +my @fields  = ( 'paid', 'payinfo' ); +my @types   = ( '', '' ); +my @align   = ( 'r', 'r' ); +my @sizes   = ( 8, 10 ); +my @colors  = ( '', '' );  my %param   = (); -my @footer  = ( "$money_char", '_TOTAL', '' ); -my @footer_align = ( 'c', 'r', 'r' ); +my @footer  = ( '_TOTAL', '' ); +my @footer_align = ( 'r', 'r' );  my $custnum_update_callback = '';  if ( FS::Record->scalar_sql('SELECT COUNT(*) FROM part_pkg_discount') ) { +  #push @header, 'Discount';    push @header, '';    push @fields, 'discount_term';    push @types, 'immutable'; @@ -119,6 +120,7 @@ if ( FS::Record->scalar_sql('SELECT COUNT(*) FROM part_pkg_discount') ) {    $custnum_update_callback = 'select_discount_term';  } +#push @header, 'Error';  push @header, '';  push @fields, 'error';  push @types, 'immutable'; diff --git a/httemplate/misc/process/batch-cust_pay.cgi b/httemplate/misc/process/batch-cust_pay.cgi index aa371266c..a6b90ea74 100644 --- a/httemplate/misc/process/batch-cust_pay.cgi +++ b/httemplate/misc/process/batch-cust_pay.cgi @@ -19,7 +19,7 @@  %        'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,  %      });  %    } -%    if ( !$cust_main ) { # not found, try agent_custid +%    if ( length($custnum) and !$cust_main ) { # not found, try agent_custid  %      $cust_main = qsearchs({   %        'table'     => 'cust_main',  %        'hashref'   => { 'agent_custid' => $custnum }, diff --git a/httemplate/misc/xmlhttp-cust_main-discount_terms.cgi b/httemplate/misc/xmlhttp-cust_main-discount_terms.cgi index 71e2da597..b524e69fc 100644 --- a/httemplate/misc/xmlhttp-cust_main-discount_terms.cgi +++ b/httemplate/misc/xmlhttp-cust_main-discount_terms.cgi @@ -2,15 +2,18 @@  %   %   my $return = [];  %   my $custnum = $cgi->param('arg'); -%   my $cust_main = ''; -%   $cust_main = qsearchs({ -%     'table'   => 'cust_main', -%     'hashref' => { 'custnum' => $custnum }, -%     'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, -%   }); +%   if ( $custnum =~ /^\d+$/ ) { +%     my $cust_main = ''; +%     $cust_main = qsearchs({ +%       'table'   => 'cust_main', +%       'hashref' => { 'custnum' => $custnum }, +%       'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +%     });  %      -%   if ($cust_main) { -%     $return = [ map [ $_, "$_ months" ], $cust_main->discount_terms ]; +%     if ($cust_main) { +%       $return = [ map [ $_, sprintf("%d months", $_) ],  +%         $cust_main->discount_terms ]; +%     }  %   }  %  <% objToJson($return) %> diff --git a/httemplate/misc/xmlhttp-cust_main-search.cgi b/httemplate/misc/xmlhttp-cust_main-search.cgi index 68c5bf597..436501e8b 100644 --- a/httemplate/misc/xmlhttp-cust_main-search.cgi +++ b/httemplate/misc/xmlhttp-cust_main-search.cgi @@ -18,9 +18,13 @@  % } elsif ( $sub eq 'invnum_search' ) {  %  %   my $string = $cgi->param('arg'); -%   my $inv = qsearchs('cust_bill', { 'invnum' => $string }); -%   my $return = $inv ? findbycustnum($inv->custnum,0) : []; +%   if ( $string =~ /^(\d+)$/ ) { +%     my $inv = qsearchs('cust_bill', { 'invnum' => $1 }); +%     my $return = $inv ? findbycustnum($inv->custnum,0) : [];  <% objToJson($return) %> +%   } else { #return nothing +[] +%   }  % }   % elsif ( $sub eq 'exact_search' ) {  %   # XXX possibly should query each element separately | 
